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 <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
13 #include "base/metrics/field_trial.h" | 14 #include "base/metrics/field_trial.h" |
14 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
15 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
17 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 if (!BrowsingDataHelper::IsWebScheme( | 220 if (!BrowsingDataHelper::IsWebScheme( |
220 web_contents()->GetLastCommittedURL().scheme())) { | 221 web_contents()->GetLastCommittedURL().scheme())) { |
221 return false; | 222 return false; |
222 } | 223 } |
223 | 224 |
224 if (IsTheHotNewBubbleUIEnabled()) { | 225 if (IsTheHotNewBubbleUIEnabled()) { |
225 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 226 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
226 PasswordsClientUIDelegateFromWebContents(web_contents()); | 227 PasswordsClientUIDelegateFromWebContents(web_contents()); |
227 if (update_password && IsUpdatePasswordUIEnabled()) { | 228 if (update_password && IsUpdatePasswordUIEnabled()) { |
228 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( | 229 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( |
229 form_to_save.Pass()); | 230 std::move(form_to_save)); |
230 } else { | 231 } else { |
231 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); | 232 manage_passwords_ui_controller->OnPasswordSubmitted( |
| 233 std::move(form_to_save)); |
232 } | 234 } |
233 } else { | 235 } else { |
234 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) | 236 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) |
235 if (form_to_save->IsBlacklisted()) | 237 if (form_to_save->IsBlacklisted()) |
236 return false; | 238 return false; |
237 std::string uma_histogram_suffix( | 239 std::string uma_histogram_suffix( |
238 password_manager::metrics_util::GroupIdToString( | 240 password_manager::metrics_util::GroupIdToString( |
239 password_manager::metrics_util::MonitoredDomainGroupId( | 241 password_manager::metrics_util::MonitoredDomainGroupId( |
240 form_to_save->pending_credentials().signon_realm, GetPrefs()))); | 242 form_to_save->pending_credentials().signon_realm, GetPrefs()))); |
241 SavePasswordInfoBarDelegate::Create( | 243 SavePasswordInfoBarDelegate::Create( |
(...skipping 13 matching lines...) Expand all Loading... |
255 #if defined(OS_ANDROID) | 257 #if defined(OS_ANDROID) |
256 // Deletes itself on the event from Java counterpart, when user interacts with | 258 // Deletes itself on the event from Java counterpart, when user interacts with |
257 // dialog. | 259 // dialog. |
258 AccountChooserDialogAndroid* acccount_chooser_dialog = | 260 AccountChooserDialogAndroid* acccount_chooser_dialog = |
259 new AccountChooserDialogAndroid(web_contents(), local_forms.Pass(), | 261 new AccountChooserDialogAndroid(web_contents(), local_forms.Pass(), |
260 federated_forms.Pass(), origin, callback); | 262 federated_forms.Pass(), origin, callback); |
261 acccount_chooser_dialog->ShowDialog(); | 263 acccount_chooser_dialog->ShowDialog(); |
262 return true; | 264 return true; |
263 #else | 265 #else |
264 return PasswordsClientUIDelegateFromWebContents(web_contents()) | 266 return PasswordsClientUIDelegateFromWebContents(web_contents()) |
265 ->OnChooseCredentials(local_forms.Pass(), federated_forms.Pass(), origin, | 267 ->OnChooseCredentials(std::move(local_forms), std::move(federated_forms), |
266 callback); | 268 origin, callback); |
267 #endif | 269 #endif |
268 } | 270 } |
269 | 271 |
270 void ChromePasswordManagerClient::ForceSavePassword() { | 272 void ChromePasswordManagerClient::ForceSavePassword() { |
271 password_manager::ContentPasswordManagerDriver* driver = | 273 password_manager::ContentPasswordManagerDriver* driver = |
272 driver_factory_->GetDriverForFrame(web_contents()->GetFocusedFrame()); | 274 driver_factory_->GetDriverForFrame(web_contents()->GetFocusedFrame()); |
273 driver->ForceSavePassword(); | 275 driver->ForceSavePassword(); |
274 } | 276 } |
275 | 277 |
276 void ChromePasswordManagerClient::NotifyUserAutoSignin( | 278 void ChromePasswordManagerClient::NotifyUserAutoSignin( |
277 ScopedVector<autofill::PasswordForm> local_forms) { | 279 ScopedVector<autofill::PasswordForm> local_forms) { |
278 DCHECK(!local_forms.empty()); | 280 DCHECK(!local_forms.empty()); |
279 #if BUILDFLAG(ANDROID_JAVA_UI) | 281 #if BUILDFLAG(ANDROID_JAVA_UI) |
280 ShowAutoSigninPrompt(web_contents(), local_forms[0]->username_value); | 282 ShowAutoSigninPrompt(web_contents(), local_forms[0]->username_value); |
281 #else | 283 #else |
282 PasswordsClientUIDelegateFromWebContents(web_contents()) | 284 PasswordsClientUIDelegateFromWebContents(web_contents()) |
283 ->OnAutoSignin(local_forms.Pass()); | 285 ->OnAutoSignin(std::move(local_forms)); |
284 | 286 |
285 #endif | 287 #endif |
286 } | 288 } |
287 | 289 |
288 void ChromePasswordManagerClient::AutomaticPasswordSave( | 290 void ChromePasswordManagerClient::AutomaticPasswordSave( |
289 scoped_ptr<password_manager::PasswordFormManager> saved_form) { | 291 scoped_ptr<password_manager::PasswordFormManager> saved_form) { |
290 #if BUILDFLAG(ANDROID_JAVA_UI) | 292 #if BUILDFLAG(ANDROID_JAVA_UI) |
291 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); | 293 GeneratedPasswordSavedInfoBarDelegateAndroid::Create(web_contents()); |
292 #else | 294 #else |
293 if (IsTheHotNewBubbleUIEnabled()) { | 295 if (IsTheHotNewBubbleUIEnabled()) { |
294 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 296 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
295 PasswordsClientUIDelegateFromWebContents(web_contents()); | 297 PasswordsClientUIDelegateFromWebContents(web_contents()); |
296 manage_passwords_ui_controller->OnAutomaticPasswordSave( | 298 manage_passwords_ui_controller->OnAutomaticPasswordSave( |
297 saved_form.Pass()); | 299 std::move(saved_form)); |
298 } | 300 } |
299 #endif | 301 #endif |
300 } | 302 } |
301 | 303 |
302 void ChromePasswordManagerClient::PasswordWasAutofilled( | 304 void ChromePasswordManagerClient::PasswordWasAutofilled( |
303 const autofill::PasswordFormMap& best_matches, | 305 const autofill::PasswordFormMap& best_matches, |
304 const GURL& origin) const { | 306 const GURL& origin) const { |
305 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 307 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
306 PasswordsClientUIDelegateFromWebContents(web_contents()); | 308 PasswordsClientUIDelegateFromWebContents(web_contents()); |
307 if (manage_passwords_ui_controller && IsTheHotNewBubbleUIEnabled()) | 309 if (manage_passwords_ui_controller && IsTheHotNewBubbleUIEnabled()) |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 | 544 |
543 const password_manager::CredentialsFilter* | 545 const password_manager::CredentialsFilter* |
544 ChromePasswordManagerClient::GetStoreResultFilter() const { | 546 ChromePasswordManagerClient::GetStoreResultFilter() const { |
545 return &credentials_filter_; | 547 return &credentials_filter_; |
546 } | 548 } |
547 | 549 |
548 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 550 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
549 const { | 551 const { |
550 return log_manager_.get(); | 552 return log_manager_.get(); |
551 } | 553 } |
OLD | NEW |