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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 std::move(form_to_save)); | 233 std::move(form_to_save)); |
233 } else { | 234 } else { |
234 manage_passwords_ui_controller->OnPasswordSubmitted( | 235 manage_passwords_ui_controller->OnPasswordSubmitted( |
235 std::move(form_to_save)); | 236 std::move(form_to_save)); |
236 } | 237 } |
237 #endif | 238 #endif |
238 } else { | 239 } else { |
239 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) | 240 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) |
240 if (form_to_save->IsBlacklisted()) | 241 if (form_to_save->IsBlacklisted()) |
241 return false; | 242 return false; |
| 243 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 244 if (update_password && IsUpdatePasswordUIEnabled()) { |
| 245 UpdatePasswordInfoBarDelegate::Create(web_contents(), |
| 246 std::move(form_to_save)); |
| 247 return true; |
| 248 } |
| 249 #endif |
242 std::string uma_histogram_suffix( | 250 std::string uma_histogram_suffix( |
243 password_manager::metrics_util::GroupIdToString( | 251 password_manager::metrics_util::GroupIdToString( |
244 password_manager::metrics_util::MonitoredDomainGroupId( | 252 password_manager::metrics_util::MonitoredDomainGroupId( |
245 form_to_save->pending_credentials().signon_realm, GetPrefs()))); | 253 form_to_save->pending_credentials().signon_realm, GetPrefs()))); |
246 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), | 254 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), |
247 uma_histogram_suffix); | 255 uma_histogram_suffix); |
248 #else | 256 #else |
249 NOTREACHED() << "Aura platforms should always use the bubble"; | 257 NOTREACHED() << "Aura platforms should always use the bubble"; |
250 #endif | 258 #endif |
251 } | 259 } |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 507 |
500 // The bubble should be the default case that runs on the bots. | 508 // The bubble should be the default case that runs on the bots. |
501 return group_name != "Infobar"; | 509 return group_name != "Infobar"; |
502 #else | 510 #else |
503 // All other platforms use Aura, and therefore always show the bubble. | 511 // All other platforms use Aura, and therefore always show the bubble. |
504 return true; | 512 return true; |
505 #endif | 513 #endif |
506 } | 514 } |
507 | 515 |
508 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { | 516 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { |
509 // Currently Password update UI is implemented only for Bubble UI. | 517 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 518 return base::FeatureList::IsEnabled( |
| 519 password_manager::features::kEnablePasswordChangeSupport); |
| 520 #else |
510 return IsTheHotNewBubbleUIEnabled(); | 521 return IsTheHotNewBubbleUIEnabled(); |
| 522 #endif |
511 } | 523 } |
512 | 524 |
513 bool ChromePasswordManagerClient::EnabledForSyncSignin() { | 525 bool ChromePasswordManagerClient::EnabledForSyncSignin() { |
514 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 526 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
515 if (command_line->HasSwitch( | 527 if (command_line->HasSwitch( |
516 password_manager::switches::kDisableManagerForSyncSignin)) | 528 password_manager::switches::kDisableManagerForSyncSignin)) |
517 return false; | 529 return false; |
518 | 530 |
519 if (command_line->HasSwitch( | 531 if (command_line->HasSwitch( |
520 password_manager::switches::kEnableManagerForSyncSignin)) | 532 password_manager::switches::kEnableManagerForSyncSignin)) |
(...skipping 21 matching lines...) Expand all Loading... |
542 | 554 |
543 const password_manager::CredentialsFilter* | 555 const password_manager::CredentialsFilter* |
544 ChromePasswordManagerClient::GetStoreResultFilter() const { | 556 ChromePasswordManagerClient::GetStoreResultFilter() const { |
545 return &credentials_filter_; | 557 return &credentials_filter_; |
546 } | 558 } |
547 | 559 |
548 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 560 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
549 const { | 561 const { |
550 return log_manager_.get(); | 562 return log_manager_.get(); |
551 } | 563 } |
OLD | NEW |