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 |
53 using password_manager::ContentPasswordManagerDriverFactory; | 66 using password_manager::ContentPasswordManagerDriverFactory; |
54 using password_manager::PasswordManagerInternalsService; | 67 using password_manager::PasswordManagerInternalsService; |
55 using password_manager::PasswordManagerInternalsServiceFactory; | 68 using password_manager::PasswordManagerInternalsServiceFactory; |
56 | 69 |
57 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 70 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
58 | 71 |
59 // Shorten the name to spare line breaks. The code provides enough context | 72 // Shorten the name to spare line breaks. The code provides enough context |
60 // already. | 73 // already. |
61 typedef autofill::SavePasswordProgressLogger Logger; | 74 typedef autofill::SavePasswordProgressLogger Logger; |
62 | 75 |
(...skipping 24 matching lines...) Expand all Loading... |
87 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, | 100 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, |
88 autofill_client); | 101 autofill_client); |
89 driver_factory_ = | 102 driver_factory_ = |
90 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); | 103 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); |
91 | 104 |
92 PasswordManagerInternalsService* service = | 105 PasswordManagerInternalsService* service = |
93 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); | 106 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); |
94 if (service) | 107 if (service) |
95 can_use_log_router_ = service->RegisterClient(this); | 108 can_use_log_router_ = service->RegisterClient(this); |
96 SetUpAutofillSyncState(); | 109 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)); |
97 } | 116 } |
98 | 117 |
99 ChromePasswordManagerClient::~ChromePasswordManagerClient() { | 118 ChromePasswordManagerClient::~ChromePasswordManagerClient() { |
100 PasswordManagerInternalsService* service = | 119 PasswordManagerInternalsService* service = |
101 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); | 120 PasswordManagerInternalsServiceFactory::GetForBrowserContext(profile_); |
102 if (service) | 121 if (service) |
103 service->UnregisterClient(this); | 122 service->UnregisterClient(this); |
104 } | 123 } |
105 | 124 |
106 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { | 125 bool ChromePasswordManagerClient::IsAutomaticPasswordSavingEnabled() const { |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 | 573 |
555 if (group_name == "DisallowSyncCredentialsForReauth") { | 574 if (group_name == "DisallowSyncCredentialsForReauth") { |
556 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 575 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
557 } else if (group_name == "DisallowSyncCredentials") { | 576 } else if (group_name == "DisallowSyncCredentials") { |
558 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 577 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
559 } else { | 578 } else { |
560 // Allow by default. | 579 // Allow by default. |
561 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 580 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
562 } | 581 } |
563 } | 582 } |
OLD | NEW |