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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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/url_util.h" | 46 #include "net/base/url_util.h" |
| 47 #include "third_party/re2/re2/re2.h" | 47 #include "third_party/re2/re2/re2.h" |
| 48 | 48 |
| 49 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
| 50 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" | 50 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" |
| 51 #endif | 51 #endif |
| 52 | 52 |
| 53 namespace { | |
| 54 void ReportOsPassword() { | |
|
vabr (Chromium)
2014/12/09 10:08:16
nit: The example snippet for unnamed namespaces in
vasilii
2014/12/09 11:02:53
Done. The same snippet suggests wrong indent for '
vabr (Chromium)
2014/12/09 11:29:16
Good point! :) Time to leave your trace in the Chr
| |
| 55 password_manager_util::OsPasswordStatus status = | |
| 56 password_manager_util::GetOsPasswordStatus(); | |
| 57 | |
| 58 UMA_HISTOGRAM_ENUMERATION("PasswordManager.OsPasswordStatus", | |
| 59 status, | |
| 60 password_manager_util::MAX_PASSWORD_STATUS); | |
| 61 } | |
| 62 } // namespace | |
| 63 | |
| 53 using password_manager::ContentPasswordManagerDriverFactory; | 64 using password_manager::ContentPasswordManagerDriverFactory; |
| 54 using password_manager::PasswordManagerInternalsService; | 65 using password_manager::PasswordManagerInternalsService; |
| 55 using password_manager::PasswordManagerInternalsServiceFactory; | 66 using password_manager::PasswordManagerInternalsServiceFactory; |
| 56 | 67 |
| 57 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 68 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
| 58 | 69 |
| 59 // Shorten the name to spare line breaks. The code provides enough context | 70 // Shorten the name to spare line breaks. The code provides enough context |
| 60 // already. | 71 // already. |
| 61 typedef autofill::SavePasswordProgressLogger Logger; | 72 typedef autofill::SavePasswordProgressLogger Logger; |
| 62 | 73 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 87 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, | 98 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, |
| 88 autofill_client); | 99 autofill_client); |
| 89 driver_factory_ = | 100 driver_factory_ = |
| 90 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); | 101 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); |
| 91 | 102 |
| 92 PasswordManagerInternalsService* service = | 103 PasswordManagerInternalsService* service = |
| 93 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); | 104 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); |
| 94 if (service) | 105 if (service) |
| 95 can_use_log_router_ = service->RegisterClient(this); | 106 can_use_log_router_ = service->RegisterClient(this); |
| 96 SetUpAutofillSyncState(); | 107 SetUpAutofillSyncState(); |
| 108 // Avoid checking OS password until later on in browser startup | |
| 109 // since it calls a few Windows APIs. | |
| 110 base::MessageLoopProxy::current()->PostDelayedTask( | |
| 111 FROM_HERE, | |
| 112 base::Bind(&ReportOsPassword), | |
| 113 base::TimeDelta::FromSeconds(10)); | |
| 97 } | 114 } |
| 98 | 115 |
| 99 ChromePasswordManagerClient::~ChromePasswordManagerClient() { | 116 ChromePasswordManagerClient::~ChromePasswordManagerClient() { |
| 100 PasswordManagerInternalsService* service = | 117 PasswordManagerInternalsService* service = |
| 101 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); | 118 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); |
| 102 if (service) | 119 if (service) |
| 103 service->UnregisterClient(this); | 120 service->UnregisterClient(this); |
| 104 } | 121 } |
| 105 | 122 |
| 106 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { | 123 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 | 571 |
| 555 if (group_name == "DisallowSyncCredentialsForReauth") { | 572 if (group_name == "DisallowSyncCredentialsForReauth") { |
| 556 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 573 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
| 557 } else if (group_name == "DisallowSyncCredentials") { | 574 } else if (group_name == "DisallowSyncCredentials") { |
| 558 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 575 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
| 559 } else { | 576 } else { |
| 560 // Allow by default. | 577 // Allow by default. |
| 561 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 578 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
| 562 } | 579 } |
| 563 } | 580 } |
| OLD | NEW |