Chromium Code Reviews| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 scoped_ptr<password_manager::PasswordFormManager> form_to_save, | 217 scoped_ptr<password_manager::PasswordFormManager> form_to_save, |
| 217 password_manager::CredentialSourceType type, | 218 password_manager::CredentialSourceType type, |
| 218 bool update_password) { | 219 bool update_password) { |
| 219 // Save password infobar and the password bubble prompts in case of | 220 // Save password infobar and the password bubble prompts in case of |
| 220 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). | 221 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). |
| 221 if (!BrowsingDataHelper::IsWebScheme( | 222 if (!BrowsingDataHelper::IsWebScheme( |
| 222 web_contents()->GetLastCommittedURL().scheme())) { | 223 web_contents()->GetLastCommittedURL().scheme())) { |
| 223 return false; | 224 return false; |
| 224 } | 225 } |
| 225 | 226 |
| 227 LOG(ERROR) << "PromptUserToSaveOrUpdatePassword"; | |
|
gone
2016/01/26 19:59:22
Remove all these debugging logs.
melandory
2016/01/29 15:56:14
Done.
| |
| 228 | |
| 226 if (IsTheHotNewBubbleUIEnabled()) { | 229 if (IsTheHotNewBubbleUIEnabled()) { |
| 227 #if !BUILDFLAG(ANDROID_JAVA_UI) | 230 #if !BUILDFLAG(ANDROID_JAVA_UI) |
| 228 PasswordsClientUIDelegate* manage_passwords_ui_controller = | 231 PasswordsClientUIDelegate* manage_passwords_ui_controller = |
| 229 PasswordsClientUIDelegateFromWebContents(web_contents()); | 232 PasswordsClientUIDelegateFromWebContents(web_contents()); |
| 230 if (update_password && IsUpdatePasswordUIEnabled()) { | 233 if (update_password && IsUpdatePasswordUIEnabled()) { |
| 231 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( | 234 manage_passwords_ui_controller->OnUpdatePasswordSubmitted( |
| 232 std::move(form_to_save)); | 235 std::move(form_to_save)); |
| 233 } else { | 236 } else { |
| 234 manage_passwords_ui_controller->OnPasswordSubmitted( | 237 manage_passwords_ui_controller->OnPasswordSubmitted( |
| 235 std::move(form_to_save)); | 238 std::move(form_to_save)); |
| 236 } | 239 } |
| 237 #endif | 240 #endif |
| 238 } else { | 241 } else { |
| 242 LOG(ERROR) << "Not bubble UI"; | |
| 239 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) | 243 #if defined(OS_MACOSX) || BUILDFLAG(ANDROID_JAVA_UI) |
| 240 if (form_to_save->IsBlacklisted()) | 244 if (form_to_save->IsBlacklisted()) |
| 241 return false; | 245 return false; |
| 242 std::string uma_histogram_suffix( | 246 LOG(ERROR) << "Is update " << update_password << " " |
| 243 password_manager::metrics_util::GroupIdToString( | 247 << IsUpdatePasswordUIEnabled(); |
| 244 password_manager::metrics_util::MonitoredDomainGroupId( | 248 if (update_password && IsUpdatePasswordUIEnabled()) { |
| 245 form_to_save->pending_credentials().signon_realm, GetPrefs()))); | 249 #if BUILDFLAG(ANDROID_JAVA_UI) |
|
gone
2016/01/26 19:59:22
This branch won't do anything at all if ANDROID_JA
melandory
2016/01/29 15:56:14
Done.
| |
| 246 SavePasswordInfoBarDelegate::Create(web_contents(), std::move(form_to_save), | 250 UpdatePasswordInfoBarDelegate::Create(web_contents(), |
| 247 uma_histogram_suffix); | 251 std::move(form_to_save)); |
| 252 #endif | |
| 253 } else { | |
| 254 std::string uma_histogram_suffix( | |
| 255 password_manager::metrics_util::GroupIdToString( | |
| 256 password_manager::metrics_util::MonitoredDomainGroupId( | |
| 257 form_to_save->pending_credentials().signon_realm, | |
| 258 GetPrefs()))); | |
| 259 SavePasswordInfoBarDelegate::Create( | |
| 260 web_contents(), std::move(form_to_save), uma_histogram_suffix); | |
| 261 } | |
| 248 #else | 262 #else |
| 249 NOTREACHED() << "Aura platforms should always use the bubble"; | 263 NOTREACHED() << "Aura platforms should always use the bubble"; |
| 250 #endif | 264 #endif |
| 251 } | 265 } |
| 252 return true; | 266 return true; |
| 253 } | 267 } |
| 254 | 268 |
| 255 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( | 269 bool ChromePasswordManagerClient::PromptUserToChooseCredentials( |
| 256 ScopedVector<autofill::PasswordForm> local_forms, | 270 ScopedVector<autofill::PasswordForm> local_forms, |
| 257 ScopedVector<autofill::PasswordForm> federated_forms, | 271 ScopedVector<autofill::PasswordForm> federated_forms, |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 | 513 |
| 500 // The bubble should be the default case that runs on the bots. | 514 // The bubble should be the default case that runs on the bots. |
| 501 return group_name != "Infobar"; | 515 return group_name != "Infobar"; |
| 502 #else | 516 #else |
| 503 // All other platforms use Aura, and therefore always show the bubble. | 517 // All other platforms use Aura, and therefore always show the bubble. |
| 504 return true; | 518 return true; |
| 505 #endif | 519 #endif |
| 506 } | 520 } |
| 507 | 521 |
| 508 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { | 522 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const { |
| 509 // Currently Password update UI is implemented only for Bubble UI. | 523 #if defined(OS_MACOSX) |
| 524 if (!ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) { | |
| 525 // Currently Password update UI is implemented only for Bubble UI. | |
| 526 return false; | |
| 527 } | |
| 528 return base::FeatureList::IsEnabled( | |
| 529 password_manager::features::kEnablePasswordChangeSupport); | |
| 530 #elif BUILDFLAG(ANDROID_JAVA_UI) | |
| 531 LOG(ERROR) << "IsUpdatePasswordUIEnabled " | |
| 532 << base::FeatureList::IsEnabled( | |
| 533 password_manager::features::kEnablePasswordChangeSupport); | |
| 534 return base::FeatureList::IsEnabled( | |
| 535 password_manager::features::kEnablePasswordChangeSupport); | |
| 536 #else | |
| 510 return IsTheHotNewBubbleUIEnabled(); | 537 return IsTheHotNewBubbleUIEnabled(); |
| 538 #endif | |
| 511 } | 539 } |
| 512 | 540 |
| 513 bool ChromePasswordManagerClient::EnabledForSyncSignin() { | 541 bool ChromePasswordManagerClient::EnabledForSyncSignin() { |
| 514 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 542 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 515 if (command_line->HasSwitch( | 543 if (command_line->HasSwitch( |
| 516 password_manager::switches::kDisableManagerForSyncSignin)) | 544 password_manager::switches::kDisableManagerForSyncSignin)) |
| 517 return false; | 545 return false; |
| 518 | 546 |
| 519 if (command_line->HasSwitch( | 547 if (command_line->HasSwitch( |
| 520 password_manager::switches::kEnableManagerForSyncSignin)) | 548 password_manager::switches::kEnableManagerForSyncSignin)) |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 542 | 570 |
| 543 const password_manager::CredentialsFilter* | 571 const password_manager::CredentialsFilter* |
| 544 ChromePasswordManagerClient::GetStoreResultFilter() const { | 572 ChromePasswordManagerClient::GetStoreResultFilter() const { |
| 545 return &credentials_filter_; | 573 return &credentials_filter_; |
| 546 } | 574 } |
| 547 | 575 |
| 548 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 576 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
| 549 const { | 577 const { |
| 550 return log_manager_.get(); | 578 return log_manager_.get(); |
| 551 } | 579 } |
| OLD | NEW |