| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 if (manage_passwords_bubble_ui_controller && | 84 if (manage_passwords_bubble_ui_controller && |
| 85 CommandLine::ForCurrentProcess()->HasSwitch( | 85 CommandLine::ForCurrentProcess()->HasSwitch( |
| 86 switches::kEnableSavePasswordBubble)) { | 86 switches::kEnableSavePasswordBubble)) { |
| 87 manage_passwords_bubble_ui_controller->OnPasswordAutofilled(best_matches); | 87 manage_passwords_bubble_ui_controller->OnPasswordAutofilled(best_matches); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 void ChromePasswordManagerClient::AuthenticateAutofillAndFillForm( | 91 void ChromePasswordManagerClient::AuthenticateAutofillAndFillForm( |
| 92 scoped_ptr<autofill::PasswordFormFillData> fill_data) { | 92 scoped_ptr<autofill::PasswordFormFillData> fill_data) { |
| 93 #if defined(OS_ANDROID) | 93 #if defined(OS_ANDROID) |
| 94 if (PasswordAuthenticationManager | 94 PasswordAuthenticationManager::AuthenticatePasswordAutofill( |
| 95 ::IsAutofillPasswordAuthenticationEnabled()) { | 95 web_contents_, |
| 96 PasswordAuthenticationManager::AuthenticatePasswordAutofill( | 96 base::Bind(&ChromePasswordManagerClient::CommitFillPasswordForm, |
| 97 web_contents_, | 97 weak_factory_.GetWeakPtr(), |
| 98 base::Bind(&ChromePasswordManagerClient::CommitFillPasswordForm, | 98 base::Owned(fill_data.release()))); |
| 99 weak_factory_.GetWeakPtr(), | 99 #else |
| 100 base::Owned(fill_data.release()))); | |
| 101 return; | |
| 102 } | |
| 103 #endif // OS_ANDROID | |
| 104 | |
| 105 // Additional authentication is currently only available for Android, so all | 100 // Additional authentication is currently only available for Android, so all |
| 106 // other plaftorms should just fill the password form directly. | 101 // other plaftorms should just fill the password form directly. |
| 107 CommitFillPasswordForm(fill_data.get()); | 102 CommitFillPasswordForm(fill_data.get()); |
| 103 #endif // OS_ANDROID |
| 108 } | 104 } |
| 109 | 105 |
| 110 Profile* ChromePasswordManagerClient::GetProfile() { | 106 Profile* ChromePasswordManagerClient::GetProfile() { |
| 111 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); | 107 return Profile::FromBrowserContext(web_contents_->GetBrowserContext()); |
| 112 } | 108 } |
| 113 | 109 |
| 114 PrefService* ChromePasswordManagerClient::GetPrefs() { | 110 PrefService* ChromePasswordManagerClient::GetPrefs() { |
| 115 return GetProfile()->GetPrefs(); | 111 return GetProfile()->GetPrefs(); |
| 116 } | 112 } |
| 117 | 113 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 ChromePasswordManagerClient::FromWebContents(contents); | 166 ChromePasswordManagerClient::FromWebContents(contents); |
| 171 if (!client) | 167 if (!client) |
| 172 return NULL; | 168 return NULL; |
| 173 return client->GetDriver()->GetPasswordManager(); | 169 return client->GetDriver()->GetPasswordManager(); |
| 174 } | 170 } |
| 175 | 171 |
| 176 void ChromePasswordManagerClient::CommitFillPasswordForm( | 172 void ChromePasswordManagerClient::CommitFillPasswordForm( |
| 177 autofill::PasswordFormFillData* data) { | 173 autofill::PasswordFormFillData* data) { |
| 178 driver_.FillPasswordForm(*data); | 174 driver_.FillPasswordForm(*data); |
| 179 } | 175 } |
| OLD | NEW |