| OLD | NEW |
| 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" |
| 11 #include "components/secure_display/elide_url.h" | 11 #include "components/url_formatter/elide_url.h" |
| 12 #include "net/base/net_util.h" | 12 #include "net/base/net_util.h" |
| 13 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 13 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 17 #include "ui/gfx/image/image_skia.h" | 17 #include "ui/gfx/image/image_skia.h" |
| 18 #include "ui/gfx/image/image_skia_operations.h" | 18 #include "ui/gfx/image/image_skia_operations.h" |
| 19 #include "ui/gfx/range/range.h" | 19 #include "ui/gfx/range/range.h" |
| 20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 21 | 21 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 49 | 49 |
| 50 // 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. |
| 51 // 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 |
| 52 // URL differs or not. | 52 // URL differs or not. |
| 53 bool target_domain_differs = | 53 bool target_domain_differs = |
| 54 !net::registry_controlled_domains::SameDomainOrHost( | 54 !net::registry_controlled_domains::SameDomainOrHost( |
| 55 user_visible_url, form_origin_url, | 55 user_visible_url, form_origin_url, |
| 56 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 56 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
| 57 if (target_domain_differs) { | 57 if (target_domain_differs) { |
| 58 title_id = IDS_SAVE_PASSWORD_TITLE; | 58 title_id = IDS_SAVE_PASSWORD_TITLE; |
| 59 replacements.push_back(secure_display::FormatUrlForSecurityDisplay( | 59 replacements.push_back(url_formatter::FormatUrlForSecurityDisplay( |
| 60 form_origin_url, std::string())); | 60 form_origin_url, std::string())); |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (is_smartlock_branding_enabled) { | 63 if (is_smartlock_branding_enabled) { |
| 64 // "Google Smart Lock" should be a hyperlink. | 64 // "Google Smart Lock" should be a hyperlink. |
| 65 base::string16 title_link = | 65 base::string16 title_link = |
| 66 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); | 66 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); |
| 67 replacements.insert(replacements.begin(), title_link); | 67 replacements.insert(replacements.begin(), title_link); |
| 68 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); | 68 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); |
| 69 *title_link_range = | 69 *title_link_range = |
| 70 gfx::Range(offsets[0], offsets[0] + title_link.length()); | 70 gfx::Range(offsets[0], offsets[0] + title_link.length()); |
| 71 } else { | 71 } else { |
| 72 replacements.insert( | 72 replacements.insert( |
| 73 replacements.begin(), | 73 replacements.begin(), |
| 74 l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND)); | 74 l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND)); |
| 75 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); | 75 *title = l10n_util::GetStringFUTF16(title_id, replacements, &offsets); |
| 76 } | 76 } |
| 77 } | 77 } |
| OLD | NEW |