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

Side by Side Diff: chrome/browser/ui/passwords/manage_passwords_view_utils.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_view_utils.h" 5 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/grit/chromium_strings.h" 8 #include "chrome/grit/chromium_strings.h"
9 #include "chrome/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
10 #include "components/password_manager/core/browser/affiliation_utils.h" 10 #include "components/password_manager/core/browser/affiliation_utils.h"
(...skipping 21 matching lines...) Expand all
32 return gfx::ImageSkiaOperations::CreateResizedImage( 32 return gfx::ImageSkiaOperations::CreateResizedImage(
33 skia_image, 33 skia_image,
34 skia::ImageOperations::RESIZE_BEST, 34 skia::ImageOperations::RESIZE_BEST,
35 gfx::Size(kAvatarImageSize, kAvatarImageSize)); 35 gfx::Size(kAvatarImageSize, kAvatarImageSize));
36 } 36 }
37 37
38 void GetSavePasswordDialogTitleTextAndLinkRange( 38 void GetSavePasswordDialogTitleTextAndLinkRange(
39 const GURL& user_visible_url, 39 const GURL& user_visible_url,
40 const GURL& form_origin_url, 40 const GURL& form_origin_url,
41 bool is_smartlock_branding_enabled, 41 bool is_smartlock_branding_enabled,
42 bool is_update_password_bubble,
42 base::string16* title, 43 base::string16* title,
43 gfx::Range* title_link_range) { 44 gfx::Range* title_link_range) {
44 std::vector<size_t> offsets; 45 std::vector<size_t> offsets;
45 std::vector<base::string16> replacements; 46 std::vector<base::string16> replacements;
46 int title_id = IDS_SAVE_PASSWORD; 47 int title_id =
48 is_update_password_bubble ? IDS_UPDATE_PASSWORD : IDS_SAVE_PASSWORD;
47 49
48 // Check whether the registry controlled domains for user-visible URL (i.e. 50 // Check whether the registry controlled domains for user-visible URL (i.e.
49 // the one seen in the omnibox) and the password form post-submit navigation 51 // the one seen in the omnibox) and the password form post-submit navigation
50 // URL differs or not. 52 // URL differs or not.
51 bool target_domain_differs = 53 bool target_domain_differs =
52 !net::registry_controlled_domains::SameDomainOrHost( 54 !net::registry_controlled_domains::SameDomainOrHost(
53 user_visible_url, form_origin_url, 55 user_visible_url, form_origin_url,
54 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 56 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
55 if (target_domain_differs) { 57 if (target_domain_differs) {
56 title_id = IDS_SAVE_PASSWORD_TITLE; 58 title_id = IDS_SAVE_PASSWORD_TITLE;
57 replacements.push_back(secure_display::FormatUrlForSecurityDisplay( 59 replacements.push_back(secure_display::FormatUrlForSecurityDisplay(
58 form_origin_url, std::string())); 60 form_origin_url, std::string()));
59 } 61 }
60 62
61 if (is_smartlock_branding_enabled) { 63 if (is_smartlock_branding_enabled) {
62 // "Google Smart Lock" should be a hyperlink. 64 // "Google Smart Lock" should be a hyperlink.
63 base::string16 title_link = 65 base::string16 title_link =
64 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); 66 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK);
65 replacements.insert(replacements.begin(), title_link); 67 replacements.insert(replacements.begin(), title_link);
66 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); 68 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets);
67 *title_link_range = 69 *title_link_range =
68 gfx::Range(offsets[0], offsets[0] + title_link.length()); 70 gfx::Range(offsets[0], offsets[0] + title_link.length());
69 } else { 71 } else {
70 replacements.insert( 72 replacements.insert(
71 replacements.begin(), 73 replacements.begin(),
72 l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND)); 74 l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND));
73 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); 75 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets);
74 } 76 }
75 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698