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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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/auto_signin_first_run_dialog_android.h
" | 68 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h
" |
69 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" | 69 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" |
| 70 #include "chrome/browser/password_manager/update_password_infobar_delegate.h" |
70 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 71 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
71 #endif | 72 #endif |
72 | 73 |
73 using password_manager::ContentPasswordManagerDriverFactory; | 74 using password_manager::ContentPasswordManagerDriverFactory; |
74 using password_manager::PasswordManagerInternalsService; | 75 using password_manager::PasswordManagerInternalsService; |
75 | 76 |
76 // Shorten the name to spare line breaks. The code provides enough context | 77 // Shorten the name to spare line breaks. The code provides enough context |
77 // already. | 78 // already. |
78 typedef autofill::SavePasswordProgressLogger Logger; | 79 typedef autofill::SavePasswordProgressLogger Logger; |
79 | 80 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 std::move(form_to_save)); | 235 std::move(form_to_save)); |
235 } else { | 236 } else { |
236 manage_passwords_ui_controller->OnPasswordSubmitted( | 237 manage_passwords_ui_controller->OnPasswordSubmitted( |
237 std::move(form_to_save)); | 238 std::move(form_to_save)); |
238 } | 239 } |
239 #endif | 240 #endif |
240 } else { | 241 } else { |
241 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) | 242 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) |
242 if (form_to_save->IsBlacklisted()) | 243 if (form_to_save->IsBlacklisted()) |
243 return false; | 244 return false; |
| 245 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 246 if (update_password && IsUpdatePasswordUIEnabled()) { |
| 247 UpdatePasswordInfoBarDelegate::Create(web_contents(), |
| 248 std::move(form_to_save)); |
| 249 return true; |
| 250 } |
| 251 #endif |
244 std::string uma_histogram_suffix( | 252 std::string uma_histogram_suffix( |
245 password_manager::metrics_util::GroupIdToString( | 253 password_manager::metrics_util::GroupIdToString( |
246 password_manager::metrics_util::MonitoredDomainGroupId( | 254 password_manager::metrics_util::MonitoredDomainGroupId( |
247 form_to_save->pending_credentials().signon_realm, GetPrefs()))); | 255 form_to_save->pending_credentials().signon_realm, GetPrefs()))); |
248 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), | 256 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), |
249 uma_histogram_suffix); | 257 uma_histogram_suffix); |
250 #else | 258 #else |
251 NOTREACHED() << "Aura platforms should always use the bubble"; | 259 NOTREACHED() << "Aura platforms should always use the bubble"; |
252 #endif | 260 #endif |
253 } | 261 } |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 | 580 |
573 // The bubble should be the default case that runs on the bots. | 581 // The bubble should be the default case that runs on the bots. |
574 return group_name != "Infobar"; | 582 return group_name != "Infobar"; |
575 #else | 583 #else |
576 // All other platforms use Aura, and therefore always show the bubble. | 584 // All other platforms use Aura, and therefore always show the bubble. |
577 return true; | 585 return true; |
578 #endif | 586 #endif |
579 } | 587 } |
580 | 588 |
581 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { | 589 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { |
582 // Currently Password update UI is implemented only for Bubble UI. | 590 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 591 return base::FeatureList::IsEnabled( |
| 592 password_manager::features::kEnablePasswordChangeSupport); |
| 593 #else |
583 return IsTheHotNewBubbleUIEnabled(); | 594 return IsTheHotNewBubbleUIEnabled(); |
| 595 #endif |
584 } | 596 } |
585 | 597 |
586 bool ChromePasswordManagerClient::EnabledForSyncSignin() { | 598 bool ChromePasswordManagerClient::EnabledForSyncSignin() { |
587 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 599 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
588 if (command_line->HasSwitch( | 600 if (command_line->HasSwitch( |
589 password_manager::switches::kDisableManagerForSyncSignin)) | 601 password_manager::switches::kDisableManagerForSyncSignin)) |
590 return false; | 602 return false; |
591 | 603 |
592 if (command_line->HasSwitch( | 604 if (command_line->HasSwitch( |
593 password_manager::switches::kEnableManagerForSyncSignin)) | 605 password_manager::switches::kEnableManagerForSyncSignin)) |
(...skipping 21 matching lines...) Expand all Loading... |
615 | 627 |
616 const password_manager::CredentialsFilter* | 628 const password_manager::CredentialsFilter* |
617 ChromePasswordManagerClient::GetStoreResultFilter() const { | 629 ChromePasswordManagerClient::GetStoreResultFilter() const { |
618 return &credentials_filter_; | 630 return &credentials_filter_; |
619 } | 631 } |
620 | 632 |
621 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 633 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
622 const { | 634 const { |
623 return log_manager_.get(); | 635 return log_manager_.get(); |
624 } | 636 } |
OLD | NEW |