diff --git a/chrome/browser/ui/views/digital_credentials/digital_identity_safety_interstitial_controller_desktop.cc b/chrome/browser/ui/views/digital_credentials/digital_identity_safety_interstitial_controller_desktop.cc index b3d53679d28a3..215851a6329df 100644 --- a/chrome/browser/ui/views/digital_credentials/digital_identity_safety_interstitial_controller_desktop.cc +++ b/chrome/browser/ui/views/digital_credentials/digital_identity_safety_interstitial_controller_desktop.cc @@ -6,7 +6,9 @@ #include +#include "base/logging.h" #include "base/metrics/histogram_functions.h" +#include "base/time/time.h" #include "base/scoped_observation.h" #include "chrome/browser/digital_credentials/digital_identity_interstitial_closed_reason.h" #include "chrome/grit/generated_resources.h" @@ -30,6 +32,10 @@ using RequestStatusForMetrics = content::DigitalIdentityProvider::RequestStatusForMetrics; using web_modal::WebContentsModalDialogManager; +namespace { +base::TimeTicks g_poc_shown_at; +} // namespace + DEFINE_LOCAL_ELEMENT_IDENTIFIER_VALUE(kContinueButtonId); DigitalIdentitySafetyInterstitialControllerDesktop::CloseOnNavigationObserver:: @@ -168,6 +174,11 @@ void DigitalIdentitySafetyInterstitialControllerDesktop::ShowInterstitialImpl( } dialog_widget_ = constrained_window::ShowWebModal( dialog_model_builder.Build(), &web_contents); + g_poc_shown_at = base::TimeTicks::Now(); + LOG(ERROR) + << "POC|DigitalIdentityInterstitial: SHOWN aborted=" << was_request_aborted + << " initially_focused=kContinueButtonId(OK) widget=" + << dialog_widget_.get(); close_on_navigation_observer_ = std::make_unique(); close_on_navigation_observer_->Observe(web_contents); @@ -184,6 +195,18 @@ void DigitalIdentitySafetyInterstitialControllerDesktop::OnDialogClosed( closed_reason = DigitalIdentityInterstitialClosedReason::kPageNavigated; } + const int delta_ms = + (base::TimeTicks::Now() - g_poc_shown_at).InMilliseconds(); + LOG(ERROR) << "POC|DigitalIdentityInterstitial: CLOSED reason=" + << static_cast(closed_reason) + << " (1=kOkButton) shown_for=" << delta_ms << "ms" + << ((closed_reason == + DigitalIdentityInterstitialClosedReason::kOkButton && + delta_ms < 500) + ? " <<< KEYJACKED: accepted inside 500ms protection " + "window" + : ""); + base::UmaHistogramEnumeration( "Blink.DigitalIdentityRequest.InterstitialClosedReason", closed_reason); diff --git a/content/browser/digital_credentials/digital_identity_request_impl.cc b/content/browser/digital_credentials/digital_identity_request_impl.cc index 9ad1c7e772dc7..a9b6d1ff5ed47 100644 --- a/content/browser/digital_credentials/digital_identity_request_impl.cc +++ b/content/browser/digital_credentials/digital_identity_request_impl.cc @@ -16,6 +16,7 @@ #include "base/functional/callback.h" #include "base/json/json_reader.h" #include "base/location.h" +#include "base/logging.h" #include "base/metrics/field_trial_params.h" #include "base/metrics/histogram_functions.h" #include "base/trace_event/trace_event.h" @@ -648,6 +649,12 @@ void DigitalIdentityRequestImpl::Abort() { void DigitalIdentityRequestImpl::OnInterstitialDone( base::Value request_to_send, RequestStatusForMetrics status_after_interstitial) { + LOG(ERROR) << "POC|DigitalIdentityRequestImpl::OnInterstitialDone status=" + << static_cast(status_after_interstitial) + << " (0=kSuccess)" + << (status_after_interstitial == RequestStatusForMetrics::kSuccess + ? " -> launching provider_->Get() (caBLE/QR flow)" + : ""); if (status_after_interstitial != RequestStatusForMetrics::kSuccess) { CompleteRequestWithError(status_after_interstitial); return; diff --git a/ui/views/input_event_activation_protector.cc b/ui/views/input_event_activation_protector.cc index 64d3057a87f15..33b57d38b445a 100644 --- a/ui/views/input_event_activation_protector.cc +++ b/ui/views/input_event_activation_protector.cc @@ -5,6 +5,7 @@ #include "ui/views/input_event_activation_protector.h" #include "base/command_line.h" +#include "base/logging.h" #include "ui/events/event.h" #include "ui/views/metrics.h" #include "ui/views/views_switches.h" @@ -58,6 +59,12 @@ bool InputEventActivationProtector::IsPossiblyUnintendedInteraction( if (!event.IsMouseEvent() && !event.IsTouchEvent() && !event.IsGestureEvent()) { if (allow_key_events || !event.IsKeyEvent()) { + LOG(ERROR) << "POC|InputProtector: key-event allow_key_events=" + << allow_key_events << " is_key=" << event.IsKeyEvent() + << " since_protected=" + << (event.time_stamp() - view_protected_time_stamp_) + .InMilliseconds() + << "ms -> BYPASS time-gate, return false"; return false; } } @@ -75,7 +82,13 @@ bool InputEventActivationProtector::IsPossiblyUnintendedInteraction( repeated_event_count_ = 0; // Unintended if the user clicked right after the view was protected. - return event.time_stamp() < view_protected_time_stamp_ + kShortInterval; + bool unintended = + event.time_stamp() < view_protected_time_stamp_ + kShortInterval; + LOG(ERROR) << "POC|InputProtector: time-gate evaluated since_protected=" + << (event.time_stamp() - view_protected_time_stamp_) + .InMilliseconds() + << "ms unintended=" << unintended; + return unintended; } void InputEventActivationProtector::OnWindowStationaryStateChanged() { diff --git a/ui/views/window/dialog_client_view.cc b/ui/views/window/dialog_client_view.cc index cea7eb5aff0ec..272e75cf9c3aa 100644 --- a/ui/views/window/dialog_client_view.cc +++ b/ui/views/window/dialog_client_view.cc @@ -11,6 +11,7 @@ #include "base/auto_reset.h" #include "base/check.h" +#include "base/logging.h" #include "base/memory/raw_ptr.h" #include "build/build_config.h" #include "ui/base/interaction/element_identifier.h" @@ -398,12 +399,19 @@ void DialogClientView::UpdateDialogButton(raw_ptr* member, void DialogClientView::ButtonPressed(ui::mojom::DialogButton type, const ui::Event& event) { DialogDelegate* const delegate = GetDialogDelegate(); + const bool allow_key = + delegate && delegate->ShouldAllowKeyEventsDuringInputProtection(); + LOG(ERROR) << "POC|DialogClientView::ButtonPressed type=" + << static_cast(type) << " (1=kOk) event_is_key=" + << event.IsKeyEvent() + << " ShouldAllowKeyEventsDuringInputProtection=" << allow_key; if (!delegate || input_protector_->IsPossiblyUnintendedInteraction( - event, /*allow_key_events=*/delegate - ->ShouldAllowKeyEventsDuringInputProtection())) { + event, /*allow_key_events=*/allow_key)) { + LOG(ERROR) << "POC|DialogClientView::ButtonPressed -> SUPPRESSED"; return; } + LOG(ERROR) << "POC|DialogClientView::ButtonPressed -> dispatching"; DCHECK(type == ui::mojom::DialogButton::kOk || type == ui::mojom::DialogButton::kCancel);