Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 #include "components/password_manager/core/browser/log_receiver.h" | 36 #include "components/password_manager/core/browser/log_receiver.h" |
| 37 #include "components/password_manager/core/browser/password_form_manager.h" | 37 #include "components/password_manager/core/browser/password_form_manager.h" |
| 38 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h" | 38 #include "components/password_manager/core/browser/password_manager_internals_se rvice.h" |
| 39 #include "components/password_manager/core/browser/password_manager_metrics_util .h" | 39 #include "components/password_manager/core/browser/password_manager_metrics_util .h" |
| 40 #include "components/password_manager/core/browser/password_manager_url_collecti on_experiment.h" | 40 #include "components/password_manager/core/browser/password_manager_url_collecti on_experiment.h" |
| 41 #include "components/password_manager/core/common/password_manager_switches.h" | 41 #include "components/password_manager/core/common/password_manager_switches.h" |
| 42 #include "content/public/browser/navigation_entry.h" | 42 #include "content/public/browser/navigation_entry.h" |
| 43 #include "content/public/browser/render_view_host.h" | 43 #include "content/public/browser/render_view_host.h" |
| 44 #include "content/public/browser/web_contents.h" | 44 #include "content/public/browser/web_contents.h" |
| 45 #include "google_apis/gaia/gaia_urls.h" | 45 #include "google_apis/gaia/gaia_urls.h" |
| 46 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | |
| 46 #include "net/base/url_util.h" | 47 #include "net/base/url_util.h" |
| 47 #include "third_party/re2/re2/re2.h" | 48 #include "third_party/re2/re2/re2.h" |
| 48 | 49 |
| 49 #if defined(OS_ANDROID) | 50 #if defined(OS_ANDROID) |
| 50 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" | 51 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" |
| 51 #endif | 52 #endif |
| 52 | 53 |
| 53 namespace { | 54 namespace { |
| 54 | 55 |
| 55 void ReportOsPassword() { | 56 void ReportOsPassword() { |
| 56 password_manager_util::OsPasswordStatus status = | 57 password_manager_util::OsPasswordStatus status = |
| 57 password_manager_util::GetOsPasswordStatus(); | 58 password_manager_util::GetOsPasswordStatus(); |
| 58 | 59 |
| 59 UMA_HISTOGRAM_ENUMERATION("PasswordManager.OsPasswordStatus", | 60 UMA_HISTOGRAM_ENUMERATION("PasswordManager.OsPasswordStatus", |
| 60 status, | 61 status, |
| 61 password_manager_util::MAX_PASSWORD_STATUS); | 62 password_manager_util::MAX_PASSWORD_STATUS); |
| 62 } | 63 } |
| 63 | 64 |
| 65 // 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.
| |
| 66 // submitting a password |login_form| navigates to the different domain/host or | |
| 67 // not. | |
| 68 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.
| |
| 69 bool target_domain_differs = | |
| 70 !net::registry_controlled_domains::SameDomainOrHost( | |
| 71 url1, url2, | |
| 72 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | |
| 73 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SubmitNavigatesToDifferentDomain", | |
| 74 target_domain_differs); | |
| 75 } | |
| 76 | |
| 64 } // namespace | 77 } // namespace |
| 65 | 78 |
| 66 using password_manager::ContentPasswordManagerDriverFactory; | 79 using password_manager::ContentPasswordManagerDriverFactory; |
| 67 using password_manager::PasswordManagerInternalsService; | 80 using password_manager::PasswordManagerInternalsService; |
| 68 using password_manager::PasswordManagerInternalsServiceFactory; | 81 using password_manager::PasswordManagerInternalsServiceFactory; |
| 69 | 82 |
| 70 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 83 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
| 71 | 84 |
| 72 // Shorten the name to spare line breaks. The code provides enough context | 85 // Shorten the name to spare line breaks. The code provides enough context |
| 73 // already. | 86 // already. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 | 216 |
| 204 bool ChromePasswordManagerClient::PromptUserToSavePassword( | 217 bool ChromePasswordManagerClient::PromptUserToSavePassword( |
| 205 scoped_ptr<password_manager::PasswordFormManager> form_to_save) { | 218 scoped_ptr<password_manager::PasswordFormManager> form_to_save) { |
| 206 // Save password infobar and the password bubble prompts in case of | 219 // Save password infobar and the password bubble prompts in case of |
| 207 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). | 220 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). |
| 208 if (!BrowsingDataHelper::IsWebScheme( | 221 if (!BrowsingDataHelper::IsWebScheme( |
| 209 web_contents()->GetLastCommittedURL().scheme())) { | 222 web_contents()->GetLastCommittedURL().scheme())) { |
| 210 return false; | 223 return false; |
| 211 } | 224 } |
| 212 | 225 |
| 226 RecordWhetherTargetDomainDiffers(password_form_visible_URL_, | |
| 227 web_contents()->GetVisibleURL()); | |
| 228 | |
| 213 if (IsTheHotNewBubbleUIEnabled()) { | 229 if (IsTheHotNewBubbleUIEnabled()) { |
| 214 ManagePasswordsUIController* manage_passwords_ui_controller = | 230 ManagePasswordsUIController* manage_passwords_ui_controller = |
| 215 ManagePasswordsUIController::FromWebContents(web_contents()); | 231 ManagePasswordsUIController::FromWebContents(web_contents()); |
| 216 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); | 232 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); |
| 217 } else { | 233 } else { |
| 218 std::string uma_histogram_suffix( | 234 std::string uma_histogram_suffix( |
| 219 password_manager::metrics_util::GroupIdToString( | 235 password_manager::metrics_util::GroupIdToString( |
| 220 password_manager::metrics_util::MonitoredDomainGroupId( | 236 password_manager::metrics_util::MonitoredDomainGroupId( |
| 221 form_to_save->realm(), GetPrefs()))); | 237 form_to_save->realm(), GetPrefs()))); |
| 222 SavePasswordInfoBarDelegate::Create( | 238 SavePasswordInfoBarDelegate::Create( |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 | 589 |
| 574 if (group_name == "DisallowSyncCredentialsForReauth") { | 590 if (group_name == "DisallowSyncCredentialsForReauth") { |
| 575 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 591 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
| 576 } else if (group_name == "DisallowSyncCredentials") { | 592 } else if (group_name == "DisallowSyncCredentials") { |
| 577 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 593 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
| 578 } else { | 594 } else { |
| 579 // Allow by default. | 595 // Allow by default. |
| 580 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 596 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
| 581 } | 597 } |
| 582 } | 598 } |
| 599 | |
| 600 void ChromePasswordManagerClient::OnPasswordFormsParsed() { | |
| 601 // On password form being parsed, we cache the URL seen in the omnibox. This | |
| 602 // will be helpful to know how often the password form submit navigates to | |
| 603 // different domain. | |
| 604 password_form_visible_URL_ = web_contents()->GetVisibleURL(); | |
| 605 } | |
| OLD | NEW |