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

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

Issue 1233313005: Move elide_url to its own component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 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/browser/ui/elide_url.h"
9 #include "chrome/grit/chromium_strings.h" 8 #include "chrome/grit/chromium_strings.h"
10 #include "chrome/grit/generated_resources.h" 9 #include "chrome/grit/generated_resources.h"
11 #include "components/password_manager/core/browser/affiliation_utils.h" 10 #include "components/password_manager/core/browser/affiliation_utils.h"
12 #include "net/base/net_util.h" 11 #include "net/base/net_util.h"
13 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 12 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
14 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
15 #include "ui/gfx/geometry/rect.h" 14 #include "ui/gfx/geometry/rect.h"
16 #include "ui/gfx/geometry/size.h" 15 #include "ui/gfx/geometry/size.h"
17 #include "ui/gfx/image/image_skia.h" 16 #include "ui/gfx/image/image_skia.h"
18 #include "ui/gfx/image/image_skia_operations.h" 17 #include "ui/gfx/image/image_skia_operations.h"
19 #include "ui/gfx/range/range.h" 18 #include "ui/gfx/range/range.h"
19 #include "ui/secure_display/elide_url.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 const int kAvatarImageSize = 50; 22 const int kAvatarImageSize = 50;
23 23
24 gfx::ImageSkia ScaleImageForAccountAvatar(gfx::ImageSkia skia_image) { 24 gfx::ImageSkia ScaleImageForAccountAvatar(gfx::ImageSkia skia_image) {
25 gfx::Size size = skia_image.size(); 25 gfx::Size size = skia_image.size();
26 if (size.height() != size.width()) { 26 if (size.height() != size.width()) {
27 gfx::Rect target(size); 27 gfx::Rect target(size);
28 int side = std::min(size.height(), size.width()); 28 int side = std::min(size.height(), size.width());
29 target.ClampToCenteredSize(gfx::Size(side, side)); 29 target.ClampToCenteredSize(gfx::Size(side, side));
(...skipping 17 matching lines...) Expand all
47 47
48 // Check whether the registry controlled domains for user-visible URL (i.e. 48 // 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 49 // the one seen in the omnibox) and the password form post-submit navigation
50 // URL differs or not. 50 // URL differs or not.
51 bool target_domain_differs = 51 bool target_domain_differs =
52 !net::registry_controlled_domains::SameDomainOrHost( 52 !net::registry_controlled_domains::SameDomainOrHost(
53 user_visible_url, form_origin_url, 53 user_visible_url, form_origin_url,
54 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 54 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
55 if (target_domain_differs) { 55 if (target_domain_differs) {
56 title_id = IDS_SAVE_PASSWORD_TITLE; 56 title_id = IDS_SAVE_PASSWORD_TITLE;
57 replacements.push_back( 57 replacements.push_back(secure_display::FormatUrlForSecurityDisplay(
58 FormatUrlForSecurityDisplay(form_origin_url, std::string())); 58 form_origin_url, std::string()));
59 } 59 }
60 60
61 if (is_smartlock_branding_enabled) { 61 if (is_smartlock_branding_enabled) {
62 // "Google Smart Lock" should be a hyperlink. 62 // "Google Smart Lock" should be a hyperlink.
63 base::string16 title_link = 63 base::string16 title_link =
64 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); 64 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK);
65 replacements.insert(replacements.begin(), title_link); 65 replacements.insert(replacements.begin(), title_link);
66 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); 66 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets);
67 *title_link_range = 67 *title_link_range =
68 gfx::Range(offsets[0], offsets[0] + title_link.length()); 68 gfx::Range(offsets[0], offsets[0] + title_link.length());
69 } else { 69 } else {
70 replacements.insert( 70 replacements.insert(
71 replacements.begin(), 71 replacements.begin(),
72 l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND)); 72 l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND));
73 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); 73 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets);
74 } 74 }
75 } 75 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698