| 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 | |
| 55 void ReportOsPassword() { | |
| 56 password_manager_util::OsPasswordStatus status = | |
| 57 password_manager_util::GetOsPasswordStatus(); | |
| 58 | |
| 59 UMA_HISTOGRAM_ENUMERATION("PasswordManager.OsPasswordStatus", | |
| 60 status, | |
| 61 password_manager_util::MAX_PASSWORD_STATUS); | |
| 62 } | |
| 63 | |
| 64 } // namespace | |
| 65 | |
| 66 using password_manager::ContentPasswordManagerDriverFactory; | 53 using password_manager::ContentPasswordManagerDriverFactory; |
| 67 using password_manager::PasswordManagerInternalsService; | 54 using password_manager::PasswordManagerInternalsService; |
| 68 using password_manager::PasswordManagerInternalsServiceFactory; | 55 using password_manager::PasswordManagerInternalsServiceFactory; |
| 69 | 56 |
| 70 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 57 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
| 71 | 58 |
| 72 // Shorten the name to spare line breaks. The code provides enough context | 59 // Shorten the name to spare line breaks. The code provides enough context |
| 73 // already. | 60 // already. |
| 74 typedef autofill::SavePasswordProgressLogger Logger; | 61 typedef autofill::SavePasswordProgressLogger Logger; |
| 75 | 62 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 100 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, | 87 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, |
| 101 autofill_client); | 88 autofill_client); |
| 102 driver_factory_ = | 89 driver_factory_ = |
| 103 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); | 90 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); |
| 104 | 91 |
| 105 PasswordManagerInternalsService* service = | 92 PasswordManagerInternalsService* service = |
| 106 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); | 93 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); |
| 107 if (service) | 94 if (service) |
| 108 can_use_log_router_ = service->RegisterClient(this); | 95 can_use_log_router_ = service->RegisterClient(this); |
| 109 SetUpAutofillSyncState(); | 96 SetUpAutofillSyncState(); |
| 110 // Avoid checking OS password until later on in browser startup | |
| 111 // since it calls a few Windows APIs. | |
| 112 base::MessageLoopProxy::current()->PostDelayedTask( | |
| 113 FROM_HERE, | |
| 114 base::Bind(&ReportOsPassword), | |
| 115 base::TimeDelta::FromSeconds(10)); | |
| 116 } | 97 } |
| 117 | 98 |
| 118 ChromePasswordManagerClient::~ChromePasswordManagerClient() { | 99 ChromePasswordManagerClient::~ChromePasswordManagerClient() { |
| 119 PasswordManagerInternalsService* service = | 100 PasswordManagerInternalsService* service = |
| 120 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); | 101 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); |
| 121 if (service) | 102 if (service) |
| 122 service->UnregisterClient(this); | 103 service->UnregisterClient(this); |
| 123 } | 104 } |
| 124 | 105 |
| 125 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { | 106 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 | 554 |
| 574 if (group_name == "DisallowSyncCredentialsForReauth") { | 555 if (group_name == "DisallowSyncCredentialsForReauth") { |
| 575 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 556 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
| 576 } else if (group_name == "DisallowSyncCredentials") { | 557 } else if (group_name == "DisallowSyncCredentials") { |
| 577 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 558 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
| 578 } else { | 559 } else { |
| 579 // Allow by default. | 560 // Allow by default. |
| 580 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 561 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
| 581 } | 562 } |
| 582 } | 563 } |
| OLD | NEW |