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

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_bubble_model.cc

Issue 1151373006: Update Confirmation UI for saved password change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clean up Created 5 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/ui/passwords/manage_passwords_bubble_model.h" 5 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/password_manager/password_store_factory.h" 9 #include "chrome/browser/password_manager/password_store_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 240
241 void ManagePasswordsBubbleModel::OnSaveClicked() { 241 void ManagePasswordsBubbleModel::OnSaveClicked() {
242 dismissal_reason_ = metrics_util::CLICKED_SAVE; 242 dismissal_reason_ = metrics_util::CLICKED_SAVE;
243 RecordExperimentStatistics(web_contents(), dismissal_reason_); 243 RecordExperimentStatistics(web_contents(), dismissal_reason_);
244 ManagePasswordsUIController* manage_passwords_ui_controller = 244 ManagePasswordsUIController* manage_passwords_ui_controller =
245 ManagePasswordsUIController::FromWebContents(web_contents()); 245 ManagePasswordsUIController::FromWebContents(web_contents());
246 manage_passwords_ui_controller->SavePassword(); 246 manage_passwords_ui_controller->SavePassword();
247 state_ = password_manager::ui::MANAGE_STATE; 247 state_ = password_manager::ui::MANAGE_STATE;
248 } 248 }
249 249
250 void ManagePasswordsBubbleModel::OnUpdateClicked(
251 const autofill::PasswordForm& password_form) {
252 dismissal_reason_ = metrics_util::CLICKED_UPDATE;
253 RecordExperimentStatistics(web_contents(), dismissal_reason_);
254 ManagePasswordsUIController* manage_passwords_ui_controller =
255 ManagePasswordsUIController::FromWebContents(web_contents());
256 manage_passwords_ui_controller->UpdatePassword(password_form);
257 state_ = password_manager::ui::MANAGE_STATE;
258 }
259
250 void ManagePasswordsBubbleModel::OnDoneClicked() { 260 void ManagePasswordsBubbleModel::OnDoneClicked() {
251 dismissal_reason_ = metrics_util::CLICKED_DONE; 261 dismissal_reason_ = metrics_util::CLICKED_DONE;
252 } 262 }
253 263
254 // TODO(gcasto): Is it worth having this be separate from OnDoneClicked()? 264 // TODO(gcasto): Is it worth having this be separate from OnDoneClicked()?
255 // User intent is pretty similar in both cases. 265 // User intent is pretty similar in both cases.
256 void ManagePasswordsBubbleModel::OnOKClicked() { 266 void ManagePasswordsBubbleModel::OnOKClicked() {
257 dismissal_reason_ = metrics_util::CLICKED_OK; 267 dismissal_reason_ = metrics_util::CLICKED_OK;
258 } 268 }
259 269
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 return GetFieldWidth(USERNAME_FIELD); 338 return GetFieldWidth(USERNAME_FIELD);
329 } 339 }
330 340
331 // static 341 // static
332 int ManagePasswordsBubbleModel::PasswordFieldWidth() { 342 int ManagePasswordsBubbleModel::PasswordFieldWidth() {
333 return GetFieldWidth(PASSWORD_FIELD); 343 return GetFieldWidth(PASSWORD_FIELD);
334 } 344 }
335 345
336 void ManagePasswordsBubbleModel::UpdatePendingStateTitle() { 346 void ManagePasswordsBubbleModel::UpdatePendingStateTitle() {
337 title_brand_link_range_ = gfx::Range(); 347 title_brand_link_range_ = gfx::Range();
348 int title_message_id =
349 pending_password_.is_password_change_form_without_username
350 ? IDS_UPDATE_PASSWORD
351 : IDS_SAVE_PASSWORD;
338 if (never_save_passwords_) { 352 if (never_save_passwords_) {
339 title_ = l10n_util::GetStringUTF16( 353 title_ = l10n_util::GetStringUTF16(
340 IDS_MANAGE_PASSWORDS_BLACKLIST_CONFIRMATION_TITLE); 354 IDS_MANAGE_PASSWORDS_BLACKLIST_CONFIRMATION_TITLE);
341 } else if (IsSmartLockBrandingEnabled(GetProfile())) { 355 } else if (IsSmartLockBrandingEnabled(GetProfile())) {
342 // "Google Smart Lock" should be a hyperlink. 356 // "Google Smart Lock" should be a hyperlink.
343 base::string16 brand_link = 357 base::string16 brand_link =
344 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); 358 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK);
345 size_t offset = 0; 359 size_t offset = 0;
346 title_ = l10n_util::GetStringFUTF16(IDS_SAVE_PASSWORD, brand_link, &offset); 360 title_ = l10n_util::GetStringFUTF16(title_message_id, brand_link, &offset);
347 title_brand_link_range_ = gfx::Range(offset, offset + brand_link.length()); 361 title_brand_link_range_ = gfx::Range(offset, offset + brand_link.length());
348 } else { 362 } else {
349 base::string16 brand_link = 363 base::string16 brand_link =
350 l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND); 364 l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND);
351 title_ = l10n_util::GetStringFUTF16(IDS_SAVE_PASSWORD, brand_link); 365 title_ = l10n_util::GetStringFUTF16(title_message_id, brand_link);
352 } 366 }
367 save_button_text_ = l10n_util::GetStringUTF16(
vasilii 2015/06/03 18:32:01 This should go to the constructor.
dvadym 2015/06/19 15:27:29 Done.
368 pending_password_.is_password_change_form_without_username
369 ? IDS_PASSWORD_MANAGER_UPDATE_BUTTON
370 : IDS_PASSWORD_MANAGER_SAVE_BUTTON);
353 } 371 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698