| 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 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "third_party/re2/src/re2/re2.h" | 58 #include "third_party/re2/src/re2/re2.h" |
| 59 | 59 |
| 60 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) | 60 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) |
| 61 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" | 61 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 #if BUILDFLAG(ANDROID_JAVA_UI) | 64 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 65 #include "chrome/browser/android/tab_android.h" | 65 #include "chrome/browser/android/tab_android.h" |
| 66 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" | 66 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
| 67 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" | 67 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" |
| 68 #include "chrome/browser/password_manager/update_password_infobar_delegate.h" |
| 68 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 69 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
| 69 #endif | 70 #endif |
| 70 | 71 |
| 71 using password_manager::ContentPasswordManagerDriverFactory; | 72 using password_manager::ContentPasswordManagerDriverFactory; |
| 72 using password_manager::PasswordManagerInternalsService; | 73 using password_manager::PasswordManagerInternalsService; |
| 73 | 74 |
| 74 // Shorten the name to spare line breaks. The code provides enough context | 75 // Shorten the name to spare line breaks. The code provides enough context |
| 75 // already. | 76 // already. |
| 76 typedef autofill::SavePasswordProgressLogger Logger; | 77 typedef autofill::SavePasswordProgressLogger Logger; |
| 77 | 78 |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 std::move(form_to_save)); | 232 std::move(form_to_save)); |
| 232 } else { | 233 } else { |
| 233 manage_passwords_ui_controller->OnPasswordSubmitted( | 234 manage_passwords_ui_controller->OnPasswordSubmitted( |
| 234 std::move(form_to_save)); | 235 std::move(form_to_save)); |
| 235 } | 236 } |
| 236 #endif | 237 #endif |
| 237 } else { | 238 } else { |
| 238 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) | 239 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) |
| 239 if (form_to_save->IsBlacklisted()) | 240 if (form_to_save->IsBlacklisted()) |
| 240 return false; | 241 return false; |
| 242 if (update_password && IsUpdatePasswordUIEnabled()) { |
| 243 UpdatePasswordInfoBarDelegate::Create(web_contents(), |
| 244 std::move(form_to_save)); |
| 245 } else { |
| 241 std::string uma_histogram_suffix( | 246 std::string uma_histogram_suffix( |
| 242 password_manager::metrics_util::GroupIdToString( | 247 password_manager::metrics_util::GroupIdToString( |
| 243 password_manager::metrics_util::MonitoredDomainGroupId( | 248 password_manager::metrics_util::MonitoredDomainGroupId( |
| 244 form_to_save->pending_credentials().signon_realm, GetPrefs()))); | 249 form_to_save->pending_credentials().signon_realm, GetPrefs()))); |
| 245 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), | 250 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), |
| 246 uma_histogram_suffix); | 251 uma_histogram_suffix); |
| 252 } |
| 247 #else | 253 #else |
| 248 NOTREACHED() << "Aura platforms should always use the bubble"; | 254 NOTREACHED() << "Aura platforms should always use the bubble"; |
| 249 #endif | 255 #endif |
| 250 } | 256 } |
| 251 return true; | 257 return true; |
| 252 } | 258 } |
| 253 | 259 |
| 254 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( | 260 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( |
| 255 ScopedVector<autofill::PasswordForm> local_forms, | 261 ScopedVector<autofill::PasswordForm> local_forms, |
| 256 ScopedVector<autofill::PasswordForm> federated_forms, | 262 ScopedVector<autofill::PasswordForm> federated_forms, |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 511 } |
| 506 | 512 |
| 507 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { | 513 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { |
| 508 #if defined(OS_MACOSX) | 514 #if defined(OS_MACOSX) |
| 509 if (!ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) { | 515 if (!ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) { |
| 510 // Currently Password update UI is implemented only for Bubble UI. | 516 // Currently Password update UI is implemented only for Bubble UI. |
| 511 return false; | 517 return false; |
| 512 } | 518 } |
| 513 return base::FeatureList::IsEnabled( | 519 return base::FeatureList::IsEnabled( |
| 514 password_manager::features::kEnablePasswordChangeSupport); | 520 password_manager::features::kEnablePasswordChangeSupport); |
| 521 #elif BUILDFLAG(ANDROID_JAVA_UI) |
| 522 return base::FeatureList::IsEnabled( |
| 523 password_manager::features::kEnablePasswordChangeSupport); |
| 515 #else | 524 #else |
| 516 return IsTheHotNewBubbleUIEnabled(); | 525 return IsTheHotNewBubbleUIEnabled(); |
| 517 #endif | 526 #endif |
| 518 } | 527 } |
| 519 | 528 |
| 520 bool ChromePasswordManagerClient::EnabledForSyncSignin() { | 529 bool ChromePasswordManagerClient::EnabledForSyncSignin() { |
| 521 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 530 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 522 if (command_line->HasSwitch( | 531 if (command_line->HasSwitch( |
| 523 password_manager::switches::kDisableManagerForSyncSignin)) | 532 password_manager::switches::kDisableManagerForSyncSignin)) |
| 524 return false; | 533 return false; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 549 | 558 |
| 550 const password_manager::CredentialsFilter* | 559 const password_manager::CredentialsFilter* |
| 551 ChromePasswordManagerClient::GetStoreResultFilter() const { | 560 ChromePasswordManagerClient::GetStoreResultFilter() const { |
| 552 return &credentials_filter_; | 561 return &credentials_filter_; |
| 553 } | 562 } |
| 554 | 563 |
| 555 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 564 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
| 556 const { | 565 const { |
| 557 return log_manager_.get(); | 566 return log_manager_.get(); |
| 558 } | 567 } |
| OLD | NEW |