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 24 matching lines...) Expand all Loading... |
35 #include "components/password_manager/core/browser/password_manager_internals_se
rvice.h" | 35 #include "components/password_manager/core/browser/password_manager_internals_se
rvice.h" |
36 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 36 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
37 #include "components/password_manager/core/common/password_manager_switches.h" | 37 #include "components/password_manager/core/common/password_manager_switches.h" |
38 #include "content/public/browser/navigation_entry.h" | 38 #include "content/public/browser/navigation_entry.h" |
39 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" |
40 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
41 #include "google_apis/gaia/gaia_urls.h" | 41 #include "google_apis/gaia/gaia_urls.h" |
42 #include "net/base/url_util.h" | 42 #include "net/base/url_util.h" |
43 #include "third_party/re2/re2/re2.h" | 43 #include "third_party/re2/re2/re2.h" |
44 | 44 |
45 #if defined(OS_ANDROID) | |
46 #include "chrome/browser/android/password_authentication_manager.h" | |
47 #endif // OS_ANDROID | |
48 | |
49 using password_manager::PasswordManagerInternalsService; | 45 using password_manager::PasswordManagerInternalsService; |
50 using password_manager::PasswordManagerInternalsServiceFactory; | 46 using password_manager::PasswordManagerInternalsServiceFactory; |
51 | 47 |
52 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 48 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
53 | 49 |
54 // static | 50 // static |
55 void ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( | 51 void ChromePasswordManagerClient::CreateForWebContentsWithAutofillClient( |
56 content::WebContents* contents, | 52 content::WebContents* contents, |
57 autofill::AutofillClient* autofill_client) { | 53 autofill::AutofillClient* autofill_client) { |
58 if (FromWebContents(contents)) | 54 if (FromWebContents(contents)) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 void ChromePasswordManagerClient::PasswordAutofillWasBlocked( | 192 void ChromePasswordManagerClient::PasswordAutofillWasBlocked( |
197 const autofill::PasswordFormMap& best_matches) const { | 193 const autofill::PasswordFormMap& best_matches) const { |
198 ManagePasswordsUIController* controller = | 194 ManagePasswordsUIController* controller = |
199 ManagePasswordsUIController::FromWebContents(web_contents()); | 195 ManagePasswordsUIController::FromWebContents(web_contents()); |
200 if (controller && IsTheHotNewBubbleUIEnabled()) | 196 if (controller && IsTheHotNewBubbleUIEnabled()) |
201 controller->OnBlacklistBlockedAutofill(best_matches); | 197 controller->OnBlacklistBlockedAutofill(best_matches); |
202 } | 198 } |
203 | 199 |
204 void ChromePasswordManagerClient::AuthenticateAutofillAndFillForm( | 200 void ChromePasswordManagerClient::AuthenticateAutofillAndFillForm( |
205 scoped_ptr<autofill::PasswordFormFillData> fill_data) { | 201 scoped_ptr<autofill::PasswordFormFillData> fill_data) { |
206 #if defined(OS_ANDROID) | |
207 PasswordAuthenticationManager::AuthenticatePasswordAutofill( | |
208 web_contents(), | |
209 base::Bind(&ChromePasswordManagerClient::CommitFillPasswordForm, | |
210 weak_factory_.GetWeakPtr(), | |
211 base::Owned(fill_data.release()))); | |
212 #else | |
213 // Additional authentication is currently only available for Android, so all | |
214 // other plaftorms should just fill the password form directly. | |
215 CommitFillPasswordForm(fill_data.get()); | 202 CommitFillPasswordForm(fill_data.get()); |
216 #endif // OS_ANDROID | |
217 } | 203 } |
218 | 204 |
219 void ChromePasswordManagerClient::HidePasswordGenerationPopup() { | 205 void ChromePasswordManagerClient::HidePasswordGenerationPopup() { |
220 if (popup_controller_) | 206 if (popup_controller_) |
221 popup_controller_->HideAndDestroy(); | 207 popup_controller_->HideAndDestroy(); |
222 } | 208 } |
223 | 209 |
224 PrefService* ChromePasswordManagerClient::GetPrefs() { | 210 PrefService* ChromePasswordManagerClient::GetPrefs() { |
225 return profile_->GetPrefs(); | 211 return profile_->GetPrefs(); |
226 } | 212 } |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 | 492 |
507 if (group_name == "DisallowSyncCredentialsForReauth") { | 493 if (group_name == "DisallowSyncCredentialsForReauth") { |
508 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; | 494 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS_FOR_REAUTH; |
509 } else if (group_name == "DisallowSyncCredentials") { | 495 } else if (group_name == "DisallowSyncCredentials") { |
510 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; | 496 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; |
511 } else { | 497 } else { |
512 // Allow by default. | 498 // Allow by default. |
513 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; | 499 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; |
514 } | 500 } |
515 } | 501 } |
OLD | NEW |