Index: components/password_manager/core/browser/password_manager.cc |
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc |
index dbd57f0b64da98d4bd8b6c7f12a993151ae9d274..a9b95a430ede672f89d5aa071d7576fc62696dd6 100644 |
--- a/components/password_manager/core/browser/password_manager.cc |
+++ b/components/password_manager/core/browser/password_manager.cc |
@@ -20,6 +20,7 @@ |
#include "components/password_manager/core/common/password_manager_pref_names.h" |
#include "components/password_manager/core/common/password_manager_switches.h" |
#include "components/pref_registry/pref_registry_syncable.h" |
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
#if defined(OS_WIN) |
#include "base/prefs/pref_registry_simple.h" |
@@ -97,6 +98,16 @@ bool URLsEqualUpToHttpHttpsSubstitution(const GURL& a, const GURL& b) { |
return false; |
} |
+// Helper UMA reporting function for differences in URLs during form submission. |
+void RecordWhetherTargetDomainDiffers(const GURL& src, const GURL& target) { |
+ bool target_domain_differs = |
+ !net::registry_controlled_domains::SameDomainOrHost( |
+ src, target, |
+ net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
+ UMA_HISTOGRAM_BOOLEAN("PasswordManager.SubmitNavigatesToDifferentDomain", |
+ target_domain_differs); |
+} |
+ |
} // namespace |
const char PasswordManager::kOtherPossibleUsernamesExperiment[] = |
@@ -309,6 +320,11 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) { |
} |
manager->ProvisionallySave(provisionally_saved_form, action); |
provisional_save_manager_.swap(manager); |
+ |
+ // Cache the user-visible URL (i.e., the one seen in the omnibox). Once the |
+ // post-submit navigation concludes, we compare the landing URL against the |
+ // cached and report the difference through UMA. |
+ main_frame_url_ = client_->GetMainFrameURL(); |
} |
void PasswordManager::RecordFailure(ProvisionalSaveFailure failure, |
@@ -574,6 +590,8 @@ void PasswordManager::AskUserOrSavePassword() { |
} |
provisional_save_manager_->SubmitPassed(); |
+ RecordWhetherTargetDomainDiffers(main_frame_url_, client_->GetMainFrameURL()); |
+ |
if (ShouldPromptUserToSavePassword()) { |
if (logger) |
logger->LogMessage(Logger::STRING_DECISION_ASK); |