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

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: Addressed reviewers' comments Created 5 years, 5 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 return password_manager_sync_metrics::IsSyncAccountCredential( 207 return password_manager_sync_metrics::IsSyncAccountCredential(
208 profile_, username, origin); 208 profile_, username, origin);
209 } 209 }
210 210
211 void ChromePasswordManagerClient::AutofillResultsComputed() { 211 void ChromePasswordManagerClient::AutofillResultsComputed() {
212 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SyncCredentialFiltered", 212 UMA_HISTOGRAM_BOOLEAN("PasswordManager.SyncCredentialFiltered",
213 sync_credential_was_filtered_); 213 sync_credential_was_filtered_);
214 sync_credential_was_filtered_ = false; 214 sync_credential_was_filtered_ = false;
215 } 215 }
216 216
217 bool ChromePasswordManagerClient::PromptUserToSavePassword( 217 bool ChromePasswordManagerClient::PromptUserToSaveOrUpdatePassword(
218 scoped_ptr<password_manager::PasswordFormManager> form_to_save, 218 scoped_ptr<password_manager::PasswordFormManager> form_to_save,
219 password_manager::CredentialSourceType type) { 219 password_manager::CredentialSourceType type,
220 bool update_password) {
220 // Save password infobar and the password bubble prompts in case of 221 // Save password infobar and the password bubble prompts in case of
221 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://). 222 // "webby" URLs and do not prompt in case of "non-webby" URLS (e.g. file://).
222 if (!BrowsingDataHelper::IsWebScheme( 223 if (!BrowsingDataHelper::IsWebScheme(
223 web_contents()->GetLastCommittedURL().scheme())) { 224 web_contents()->GetLastCommittedURL().scheme())) {
224 return false; 225 return false;
225 } 226 }
226 227
227 if (IsTheHotNewBubbleUIEnabled()) { 228 if (IsTheHotNewBubbleUIEnabled()) {
228 ManagePasswordsUIController* manage_passwords_ui_controller = 229 ManagePasswordsUIController* manage_passwords_ui_controller =
229 ManagePasswordsUIController::FromWebContents(web_contents()); 230 ManagePasswordsUIController::FromWebContents(web_contents());
230 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass()); 231 if (update_password && IsUpdatePasswordUIEnabled()) {
232 manage_passwords_ui_controller->OnUpdatePasswordSubmitted(
233 form_to_save.Pass());
234 } else {
235 manage_passwords_ui_controller->OnPasswordSubmitted(form_to_save.Pass());
236 }
231 } else { 237 } else {
232 std::string uma_histogram_suffix( 238 std::string uma_histogram_suffix(
233 password_manager::metrics_util::GroupIdToString( 239 password_manager::metrics_util::GroupIdToString(
234 password_manager::metrics_util::MonitoredDomainGroupId( 240 password_manager::metrics_util::MonitoredDomainGroupId(
235 form_to_save->realm(), GetPrefs()))); 241 form_to_save->realm(), GetPrefs())));
236 SavePasswordInfoBarDelegate::Create( 242 SavePasswordInfoBarDelegate::Create(
237 web_contents(), form_to_save.Pass(), uma_histogram_suffix, type); 243 web_contents(), form_to_save.Pass(), uma_histogram_suffix, type);
238 } 244 }
239 return true; 245 return true;
240 } 246 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble)) 538 if (command_line->HasSwitch(switches::kEnableSavePasswordBubble))
533 return true; 539 return true;
534 540
535 std::string group_name = 541 std::string group_name =
536 base::FieldTrialList::FindFullName("PasswordManagerUI"); 542 base::FieldTrialList::FindFullName("PasswordManagerUI");
537 543
538 // The bubble should be the default case that runs on the bots. 544 // The bubble should be the default case that runs on the bots.
539 return group_name != "Infobar"; 545 return group_name != "Infobar";
540 } 546 }
541 547
548 bool ChromePasswordManagerClient::IsUpdatePasswordUIEnabled() const {
549 if (!ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) {
550 // Currently Password update UI is implemented only for Bubble UI.
551 return false;
552 }
553 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
554 return command_line->HasSwitch(
555 password_manager::switches::kEnablePasswordChangeSupport);
556 }
557
542 bool ChromePasswordManagerClient::EnabledForSyncSignin() { 558 bool ChromePasswordManagerClient::EnabledForSyncSignin() {
543 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 559 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
544 if (command_line->HasSwitch( 560 if (command_line->HasSwitch(
545 password_manager::switches::kDisableManagerForSyncSignin)) 561 password_manager::switches::kDisableManagerForSyncSignin))
546 return false; 562 return false;
547 563
548 if (command_line->HasSwitch( 564 if (command_line->HasSwitch(
549 password_manager::switches::kEnableManagerForSyncSignin)) 565 password_manager::switches::kEnableManagerForSyncSignin))
550 return true; 566 return true;
551 567
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS; 599 autofill_sync_state_ = DISALLOW_SYNC_CREDENTIALS;
584 } else { 600 } else {
585 // Allow by default. 601 // Allow by default.
586 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS; 602 autofill_sync_state_ = ALLOW_SYNC_CREDENTIALS;
587 } 603 }
588 } 604 }
589 605
590 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const { 606 const GURL& ChromePasswordManagerClient::GetMainFrameURL() const {
591 return web_contents()->GetVisibleURL(); 607 return web_contents()->GetVisibleURL();
592 } 608 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698