Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1005)

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 1151373006: Update Confirmation UI for saved password change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/singleton.h" 9 #include "base/memory/singleton.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 return password_manager_sync_metrics::IsSyncAccountCredential( 208 return password_manager_sync_metrics::IsSyncAccountCredential(
209 profile_, username, realm); 209 profile_, username, realm);
210 } 210 }
211 211
212 void ChromePasswordManagerClient::AutofillResultsComputed() { 212 void ChromePasswordManagerClient::AutofillResultsComputed() {
213 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SyncCredentialFiltered", 213 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SyncCredentialFiltered",
214 sync_credential_was_filtered_); 214 sync_credential_was_filtered_);
215 sync_credential_was_filtered_ = false; 215 sync_credential_was_filtered_ = false;
216 } 216 }
217 217
218 bool ChromePasswordManagerClient::PromptUserToSavePassword( 218 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword(
219 scoped_ptr<password_manager::PasswordFormManager> form_to_save, 219 scoped_ptr<password_manager::PasswordFormManager> form_to_save,
220 password_manager::CredentialSourceType type) { 220 password_manager::CredentialSourceType type,
221 bool update_password) {
221 // Save password infobar and the password bubble prompts in case of 222 // Save password infobar and the password bubble prompts in case of
222 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). 223 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://).
223 if (!BrowsingDataHelper::IsWebScheme( 224 if (!BrowsingDataHelper::IsWebScheme(
224 web_contents()->GetLastCommittedURL().scheme())) { 225 web_contents()->GetLastCommittedURL().scheme())) {
225 return false; 226 return false;
226 } 227 }
227 228
228 if (IsTheHotNewBubbleUIEnabled()) { 229 if (IsTheHotNewBubbleUIEnabled()) {
229 ManagePasswordsUIController* manage_passwords_ui_controller = 230 ManagePasswordsUIController* manage_passwords_ui_controller =
230 ManagePasswordsUIController::FromWebContents(web_contents()); 231 ManagePasswordsUIController::FromWebContents(web_contents());
231 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); 232 if (update_password && IsUpdatePasswordUIEnabled()) {
233 manage_passwords_ui_controller->OnUpdatePasswordSubmitted(
234 form_to_save.Pass());
235 } else {
236 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass());
237 }
232 } else { 238 } else {
233 std::string uma_histogram_suffix( 239 std::string uma_histogram_suffix(
234 password_manager::metrics_util::GroupIdToString( 240 password_manager::metrics_util::GroupIdToString(
235 password_manager::metrics_util::MonitoredDomainGroupId( 241 password_manager::metrics_util::MonitoredDomainGroupId(
236 form_to_save->realm(), GetPrefs()))); 242 form_to_save->realm(), GetPrefs())));
237 SavePasswordInfoBarDelegate::Create( 243 SavePasswordInfoBarDelegate::Create(
238 web_contents(), form_to_save.Pass(), uma_histogram_suffix, type); 244 web_contents(), form_to_save.Pass(), uma_histogram_suffix, type);
239 } 245 }
240 return true; 246 return true;
241 } 247 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble)) 539 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble))
534 return true; 540 return true;
535 541
536 std::string group_name = 542 std::string group_name =
537 base::FieldTrialList::FindFullName("PasswordManagerUI"); 543 base::FieldTrialList::FindFullName("PasswordManagerUI");
538 544
539 // The bubble should be the default case that runs on the bots. 545 // The bubble should be the default case that runs on the bots.
540 return group_name != "Infobar"; 546 return group_name != "Infobar";
541 } 547 }
542 548
549 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const {
550 if (!ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) {
551 // Currently Password update UI is implemented only for Bubble UI.
552 return false;
553 }
554 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
555 return command_line->HasSwitch(
556 password_manager::switches::kEnablePasswordChangeSupport);
557 }
558
543 bool ChromePasswordManagerClient::EnabledForSyncSignin() { 559 bool ChromePasswordManagerClient::EnabledForSyncSignin() {
544 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 560 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
545 if (command_line->HasSwitch( 561 if (command_line->HasSwitch(
546 password_manager::switches::kDisableManagerForSyncSignin)) 562 password_manager::switches::kDisableManagerForSyncSignin))
547 return false; 563 return false;
548 564
549 if (command_line->HasSwitch( 565 if (command_line->HasSwitch(
550 password_manager::switches::kEnableManagerForSyncSignin)) 566 password_manager::switches::kEnableManagerForSyncSignin))
551 return true; 567 return true;
552 568
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; 600 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS;
585 } else { 601 } else {
586 // Allow by default. 602 // Allow by default.
587 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; 603 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
588 } 604 }
589 } 605 }
590 606
591 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const { 607 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const {
592 return web_contents()->GetVisibleURL(); 608 return web_contents()->GetVisibleURL();
593 } 609 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698