| 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 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 244 UpdatePasswordInfoBarDelegate::Create(web_contents(), |
| 245 std::move(form_to_save)); |
| 246 #endif |
| 247 } else { |
| 241 std::string uma_histogram_suffix( | 248 std::string uma_histogram_suffix( |
| 242 password_manager::metrics_util::GroupIdToString( | 249 password_manager::metrics_util::GroupIdToString( |
| 243 password_manager::metrics_util::MonitoredDomainGroupId( | 250 password_manager::metrics_util::MonitoredDomainGroupId( |
| 244 form_to_save->pending_credentials().signon_realm, GetPrefs()))); | 251 form_to_save->pending_credentials().signon_realm, GetPrefs()))); |
| 245 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), | 252 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), |
| 246 uma_histogram_suffix); | 253 uma_histogram_suffix); |
| 254 } |
| 247 #else | 255 #else |
| 248 NOTREACHED() << "Aura platforms should always use the bubble"; | 256 NOTREACHED() << "Aura platforms should always use the bubble"; |
| 249 #endif | 257 #endif |
| 250 } | 258 } |
| 251 return true; | 259 return true; |
| 252 } | 260 } |
| 253 | 261 |
| 254 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( | 262 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( |
| 255 ScopedVector<autofill::PasswordForm> local_forms, | 263 ScopedVector<autofill::PasswordForm> local_forms, |
| 256 ScopedVector<autofill::PasswordForm> federated_forms, | 264 ScopedVector<autofill::PasswordForm> federated_forms, |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 513 } |
| 506 | 514 |
| 507 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { | 515 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { |
| 508 #if defined(OS_MACOSX) | 516 #if defined(OS_MACOSX) |
| 509 if (!ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) { | 517 if (!ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) { |
| 510 // Currently Password update UI is implemented only for Bubble UI. | 518 // Currently Password update UI is implemented only for Bubble UI. |
| 511 return false; | 519 return false; |
| 512 } | 520 } |
| 513 return base::FeatureList::IsEnabled( | 521 return base::FeatureList::IsEnabled( |
| 514 password_manager::features::kEnablePasswordChangeSupport); | 522 password_manager::features::kEnablePasswordChangeSupport); |
| 523 #elif BUILDFLAG(ANDROID_JAVA_UI) |
| 524 return base::FeatureList::IsEnabled( |
| 525 password_manager::features::kEnablePasswordChangeSupport); |
| 515 #else | 526 #else |
| 516 return IsTheHotNewBubbleUIEnabled(); | 527 return IsTheHotNewBubbleUIEnabled(); |
| 517 #endif | 528 #endif |
| 518 } | 529 } |
| 519 | 530 |
| 520 bool ChromePasswordManagerClient::EnabledForSyncSignin() { | 531 bool ChromePasswordManagerClient::EnabledForSyncSignin() { |
| 521 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 532 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 522 if (command_line->HasSwitch( | 533 if (command_line->HasSwitch( |
| 523 password_manager::switches::kDisableManagerForSyncSignin)) | 534 password_manager::switches::kDisableManagerForSyncSignin)) |
| 524 return false; | 535 return false; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 549 | 560 |
| 550 const password_manager::CredentialsFilter* | 561 const password_manager::CredentialsFilter* |
| 551 ChromePasswordManagerClient::GetStoreResultFilter() const { | 562 ChromePasswordManagerClient::GetStoreResultFilter() const { |
| 552 return &credentials_filter_; | 563 return &credentials_filter_; |
| 553 } | 564 } |
| 554 | 565 |
| 555 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 566 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
| 556 const { | 567 const { |
| 557 return log_manager_.get(); | 568 return log_manager_.get(); |
| 558 } | 569 } |
| OLD | NEW |