| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "third_party/re2/src/re2/re2.h" | 59 #include "third_party/re2/src/re2/re2.h" |
| 60 | 60 |
| 61 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) | 61 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) |
| 62 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" | 62 #include "chrome/browser/password_manager/save_password_infobar_delegate.h" |
| 63 #endif | 63 #endif |
| 64 | 64 |
| 65 #if BUILDFLAG(ANDROID_JAVA_UI) | 65 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 66 #include "chrome/browser/android/tab_android.h" | 66 #include "chrome/browser/android/tab_android.h" |
| 67 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" | 67 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
| 68 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" | 68 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" |
| 69 #include "chrome/browser/password_manager/update_password_infobar_delegate.h" |
| 69 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 70 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
| 70 #endif | 71 #endif |
| 71 | 72 |
| 72 using password_manager::ContentPasswordManagerDriverFactory; | 73 using password_manager::ContentPasswordManagerDriverFactory; |
| 73 using password_manager::PasswordManagerInternalsService; | 74 using password_manager::PasswordManagerInternalsService; |
| 74 | 75 |
| 75 // Shorten the name to spare line breaks. The code provides enough context | 76 // Shorten the name to spare line breaks. The code provides enough context |
| 76 // already. | 77 // already. |
| 77 typedef autofill::SavePasswordProgressLogger Logger; | 78 typedef autofill::SavePasswordProgressLogger Logger; |
| 78 | 79 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 std::move(form_to_save)); | 234 std::move(form_to_save)); |
| 234 } else { | 235 } else { |
| 235 manage_passwords_ui_controller->OnPasswordSubmitted( | 236 manage_passwords_ui_controller->OnPasswordSubmitted( |
| 236 std::move(form_to_save)); | 237 std::move(form_to_save)); |
| 237 } | 238 } |
| 238 #endif | 239 #endif |
| 239 } else { | 240 } else { |
| 240 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) | 241 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) |
| 241 if (form_to_save->IsBlacklisted()) | 242 if (form_to_save->IsBlacklisted()) |
| 242 return false; | 243 return false; |
| 244 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 245 if (update_password && IsUpdatePasswordUIEnabled()) { |
| 246 UpdatePasswordInfoBarDelegate::Create(web_contents(), |
| 247 std::move(form_to_save)); |
| 248 return true; |
| 249 } |
| 250 #endif |
| 243 std::string uma_histogram_suffix( | 251 std::string uma_histogram_suffix( |
| 244 password_manager::metrics_util::GroupIdToString( | 252 password_manager::metrics_util::GroupIdToString( |
| 245 password_manager::metrics_util::MonitoredDomainGroupId( | 253 password_manager::metrics_util::MonitoredDomainGroupId( |
| 246 form_to_save->pending_credentials().signon_realm, GetPrefs()))); | 254 form_to_save->pending_credentials().signon_realm, GetPrefs()))); |
| 247 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), | 255 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), |
| 248 uma_histogram_suffix); | 256 uma_histogram_suffix); |
| 249 #else | 257 #else |
| 250 NOTREACHED() << "Aura platforms should always use the bubble"; | 258 NOTREACHED() << "Aura platforms should always use the bubble"; |
| 251 #endif | 259 #endif |
| 252 } | 260 } |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 | 568 |
| 561 // The bubble should be the default case that runs on the bots. | 569 // The bubble should be the default case that runs on the bots. |
| 562 return group_name != "Infobar"; | 570 return group_name != "Infobar"; |
| 563 #else | 571 #else |
| 564 // All other platforms use Aura, and therefore always show the bubble. | 572 // All other platforms use Aura, and therefore always show the bubble. |
| 565 return true; | 573 return true; |
| 566 #endif | 574 #endif |
| 567 } | 575 } |
| 568 | 576 |
| 569 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { | 577 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { |
| 570 // Currently Password update UI is implemented only for Bubble UI. | 578 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 579 return base::FeatureList::IsEnabled( |
| 580 password_manager::features::kEnablePasswordChangeSupport); |
| 581 #else |
| 571 return IsTheHotNewBubbleUIEnabled(); | 582 return IsTheHotNewBubbleUIEnabled(); |
| 583 #endif |
| 572 } | 584 } |
| 573 | 585 |
| 574 bool ChromePasswordManagerClient::EnabledForSyncSignin() { | 586 bool ChromePasswordManagerClient::EnabledForSyncSignin() { |
| 575 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 587 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 576 if (command_line->HasSwitch( | 588 if (command_line->HasSwitch( |
| 577 password_manager::switches::kDisableManagerForSyncSignin)) | 589 password_manager::switches::kDisableManagerForSyncSignin)) |
| 578 return false; | 590 return false; |
| 579 | 591 |
| 580 if (command_line->HasSwitch( | 592 if (command_line->HasSwitch( |
| 581 password_manager::switches::kEnableManagerForSyncSignin)) | 593 password_manager::switches::kEnableManagerForSyncSignin)) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 603 | 615 |
| 604 const password_manager::CredentialsFilter* | 616 const password_manager::CredentialsFilter* |
| 605 ChromePasswordManagerClient::GetStoreResultFilter() const { | 617 ChromePasswordManagerClient::GetStoreResultFilter() const { |
| 606 return &credentials_filter_; | 618 return &credentials_filter_; |
| 607 } | 619 } |
| 608 | 620 |
| 609 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 621 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
| 610 const { | 622 const { |
| 611 return log_manager_.get(); | 623 return log_manager_.get(); |
| 612 } | 624 } |
| OLD | NEW |