Chromium Code Reviews| Index: chrome/browser/password_manager/chrome_password_manager_client.cc |
| diff --git a/chrome/browser/password_manager/chrome_password_manager_client.cc b/chrome/browser/password_manager/chrome_password_manager_client.cc |
| index b98f9e7d496500ebd6343c48ccf5c09388142be0..a3bd86485414a5db273ca035fb8acaf2881ebd95 100644 |
| --- a/chrome/browser/password_manager/chrome_password_manager_client.cc |
| +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc |
| @@ -43,6 +43,7 @@ |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| #include "google_apis/gaia/gaia_urls.h" |
| +#include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| #include "net/base/url_util.h" |
| #include "third_party/re2/re2/re2.h" |
| @@ -61,6 +62,18 @@ void ReportOsPassword() { |
| password_manager_util::MAX_PASSWORD_STATUS); |
| } |
| +// Helper function to capture the UMA matriculations for instances where |
|
vabr (Chromium)
2014/12/12 16:24:00
What does "matriculations" in this context mean?
h
Pritam Nikam
2014/12/15 07:41:49
Done.
|
| +// submitting a password |login_form| navigates to the different domain/host or |
| +// not. |
| +void RecordWhetherTargetDomainDiffers(const GURL& url1, const GURL& url2) { |
|
vabr (Chromium)
2014/12/12 16:24:00
nit: to put in context with the method name, maybe
Pritam Nikam
2014/12/15 07:41:49
Done.
|
| + bool target_domain_differs = |
| + !net::registry_controlled_domains::SameDomainOrHost( |
| + url1, url2, |
| + net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
| + UMA_HISTOGRAM_BOOLEAN("PasswordManager.SubmitNavigatesToDifferentDomain", |
| + target_domain_differs); |
| +} |
| + |
| } // namespace |
| using password_manager::ContentPasswordManagerDriverFactory; |
| @@ -210,6 +223,9 @@ bool ChromePasswordManagerClient::PromptUserToSavePassword( |
| return false; |
| } |
| + RecordWhetherTargetDomainDiffers(password_form_visible_URL_, |
| + web_contents()->GetVisibleURL()); |
| + |
| if (IsTheHotNewBubbleUIEnabled()) { |
| ManagePasswordsUIController* manage_passwords_ui_controller = |
| ManagePasswordsUIController::FromWebContents(web_contents()); |
| @@ -580,3 +596,10 @@ void ChromePasswordManagerClient::SetUpAutofillSyncState() { |
| autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
| } |
| } |
| + |
| +void ChromePasswordManagerClient::OnPasswordFormsParsed() { |
| + // On password form being parsed, we cache the URL seen in the omnibox. This |
| + // will be helpful to know how often the password form submit navigates to |
| + // different domain. |
| + password_form_visible_URL_ = web_contents()->GetVisibleURL(); |
| +} |