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 | |
| 66 // submitting a password |login_form| navigates to the different domain/host or | |
| 67 // not. | |
| 68 void LogFormSubmitNavigateToDifferentDomain( | |
|
vabr (Chromium)
2014/12/11 12:31:33
nit: Log->Report (logging is usually used in the d
Pritam Nikam
2014/12/12 14:30:08
Done.
| |
| 69 const autofill::PasswordForm& login_form) { | |
| 70 bool navigates_to_different_domain = | |
| 71 !net::registry_controlled_domains::SameDomainOrHost( | |
| 72 login_form.origin, login_form.action, | |
| 73 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | |
| 74 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SubmitNavigatesToDifferentDomain", | |
| 75 navigates_to_different_domain); | |
| 76 } | |
| 77 | |
| 64 } // namespace | 78 } // namespace |
| 65 | 79 |
| 66 using password_manager::ContentPasswordManagerDriverFactory; | 80 using password_manager::ContentPasswordManagerDriverFactory; |
| 67 using password_manager::PasswordManagerInternalsService; | 81 using password_manager::PasswordManagerInternalsService; |
| 68 using password_manager::PasswordManagerInternalsServiceFactory; | 82 using password_manager::PasswordManagerInternalsServiceFactory; |
| 69 | 83 |
| 70 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 84 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
| 71 | 85 |
| 72 // Shorten the name to spare line breaks. The code provides enough context | 86 // Shorten the name to spare line breaks. The code provides enough context |
| 73 // already. | 87 // already. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 | 217 |
| 204 bool ChromePasswordManagerClient::PromptUserToSavePassword( | 218 bool ChromePasswordManagerClient::PromptUserToSavePassword( |
| 205 scoped_ptr<password_manager::PasswordFormManager> form_to_save) { | 219 scoped_ptr<password_manager::PasswordFormManager> form_to_save) { |
| 206 // Save password infobar and the password bubble prompts in case of | 220 // 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://). | 221 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). |
| 208 if (!BrowsingDataHelper::IsWebScheme( | 222 if (!BrowsingDataHelper::IsWebScheme( |
| 209 web_contents()->GetLastCommittedURL().scheme())) { | 223 web_contents()->GetLastCommittedURL().scheme())) { |
| 210 return false; | 224 return false; |
| 211 } | 225 } |
| 212 | 226 |
| 227 // Capture the UMA stats to get to know the volume and frequency for | |
|
vabr (Chromium)
2014/12/11 12:31:33
I don't think this comment is necessary. We always
Pritam Nikam
2014/12/12 14:30:08
Done.
| |
| 228 // occurences where submiting the password login form lands to different | |
| 229 // domain. | |
| 230 LogFormSubmitNavigateToDifferentDomain(form_to_save->observed_form()); | |
| 231 | |
| 213 if (IsTheHotNewBubbleUIEnabled()) { | 232 if (IsTheHotNewBubbleUIEnabled()) { |
| 214 ManagePasswordsUIController* manage_passwords_ui_controller = | 233 ManagePasswordsUIController* manage_passwords_ui_controller = |
| 215 ManagePasswordsUIController::FromWebContents(web_contents()); | 234 ManagePasswordsUIController::FromWebContents(web_contents()); |
| 216 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); | 235 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); |
| 217 } else { | 236 } else { |
| 218 std::string uma_histogram_suffix( | 237 std::string uma_histogram_suffix( |
| 219 password_manager::metrics_util::GroupIdToString( | 238 password_manager::metrics_util::GroupIdToString( |
| 220 password_manager::metrics_util::MonitoredDomainGroupId( | 239 password_manager::metrics_util::MonitoredDomainGroupId( |
| 221 form_to_save->realm(), GetPrefs()))); | 240 form_to_save->realm(), GetPrefs()))); |
| 222 SavePasswordInfoBarDelegate::Create( | 241 SavePasswordInfoBarDelegate::Create( |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 | 592 |
| 574 if (group_name == "DisallowSyncCredentialsForReauth") { | 593 if (group_name == "DisallowSyncCredentialsForReauth") { |
| 575 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 594 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
| 576 } else if (group_name == "DisallowSyncCredentials") { | 595 } else if (group_name == "DisallowSyncCredentials") { |
| 577 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 596 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
| 578 } else { | 597 } else { |
| 579 // Allow by default. | 598 // Allow by default. |
| 580 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 599 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
| 581 } | 600 } |
| 582 } | 601 } |
| OLD | NEW |