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

Side by Side Diff: chrome/browser/password_manager/save_password_infobar_delegate.cc

Issue 1181623004: [Password Manager] Replace "this site" in save password prompt with password's origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses Chris's review 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/save_password_infobar_delegate.h" 5 #include "chrome/browser/password_manager/save_password_infobar_delegate.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/infobars/infobar_service.h" 8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sync/profile_sync_service.h" 10 #include "chrome/browser/sync/profile_sync_service.h"
11 #include "chrome/browser/sync/profile_sync_service_factory.h" 11 #include "chrome/browser/sync/profile_sync_service_factory.h"
12 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
12 #include "chrome/grit/chromium_strings.h" 13 #include "chrome/grit/chromium_strings.h"
13 #include "chrome/grit/generated_resources.h" 14 #include "chrome/grit/generated_resources.h"
14 #include "components/infobars/core/infobar.h" 15 #include "components/infobars/core/infobar.h"
15 #include "components/password_manager/core/browser/password_bubble_experiment.h" 16 #include "components/password_manager/core/browser/password_bubble_experiment.h"
16 #include "components/password_manager/core/browser/password_manager_client.h" 17 #include "components/password_manager/core/browser/password_manager_client.h"
17 #include "content/public/browser/web_contents.h" 18 #include "content/public/browser/web_contents.h"
18 #include "grit/theme_resources.h" 19 #include "grit/theme_resources.h"
19 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
20 21
21 #if defined(OS_ANDROID) 22 #if defined(OS_ANDROID)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 form_to_save_(form_to_save.Pass()), 104 form_to_save_(form_to_save.Pass()),
104 infobar_response_(password_manager::metrics_util::NO_RESPONSE), 105 infobar_response_(password_manager::metrics_util::NO_RESPONSE),
105 uma_histogram_suffix_(uma_histogram_suffix), 106 uma_histogram_suffix_(uma_histogram_suffix),
106 source_type_(source_type) { 107 source_type_(source_type) {
107 if (!uma_histogram_suffix_.empty()) { 108 if (!uma_histogram_suffix_.empty()) {
108 password_manager::metrics_util::LogUMAHistogramBoolean( 109 password_manager::metrics_util::LogUMAHistogramBoolean(
109 "PasswordManager.SavePasswordPromptDisplayed_" + uma_histogram_suffix_, 110 "PasswordManager.SavePasswordPromptDisplayed_" + uma_histogram_suffix_,
110 true); 111 true);
111 } 112 }
112 title_link_range_ = gfx::Range(); 113 title_link_range_ = gfx::Range();
113 if (is_smartlock_branding_enabled) { 114 GetSavePasswordDialogTitleTextAndLinkRange(
114 size_t offset = 0; 115 form_to_save_->client()->GetMainFrameURL(),
vabr (Chromium) 2015/06/29 11:49:08 Actually, rather than going through the PasswordFo
Pritam Nikam 2015/06/29 17:42:13 Done.
115 base::string16 title_link = 116 form_to_save_->observed_form().origin, is_smartlock_branding_enabled,
116 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SMART_LOCK); 117 &title_, &title_link_range_);
117 title_ = l10n_util::GetStringFUTF16(IDS_SAVE_PASSWORD, title_link, &offset);
118 title_link_range_ = gfx::Range(offset, offset + title_link.length());
119 } else {
120 title_ = l10n_util::GetStringFUTF16(
121 IDS_SAVE_PASSWORD,
122 l10n_util::GetStringUTF16(IDS_SAVE_PASSWORD_TITLE_BRAND));
123 }
124 } 118 }
125 119
126 bool SavePasswordInfoBarDelegate::ShouldShowMoreButton() { 120 bool SavePasswordInfoBarDelegate::ShouldShowMoreButton() {
127 return source_type_ == 121 return source_type_ ==
128 password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API; 122 password_manager::CredentialSourceType::CREDENTIAL_SOURCE_API;
129 } 123 }
130 124
131 infobars::InfoBarDelegate::Type 125 infobars::InfoBarDelegate::Type
132 SavePasswordInfoBarDelegate::GetInfoBarType() const { 126 SavePasswordInfoBarDelegate::GetInfoBarType() const {
133 return PAGE_ACTION_TYPE; 127 return PAGE_ACTION_TYPE;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 WindowOpenDisposition disposition) { 180 WindowOpenDisposition disposition) {
187 InfoBarService::WebContentsFromInfoBar(infobar()) 181 InfoBarService::WebContentsFromInfoBar(infobar())
188 ->OpenURL(content::OpenURLParams( 182 ->OpenURL(content::OpenURLParams(
189 GURL(l10n_util::GetStringUTF16( 183 GURL(l10n_util::GetStringUTF16(
190 IDS_PASSWORD_MANAGER_SMART_LOCK_ARTICLE)), 184 IDS_PASSWORD_MANAGER_SMART_LOCK_ARTICLE)),
191 content::Referrer(), 185 content::Referrer(),
192 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 186 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
193 ui::PAGE_TRANSITION_LINK, false)); 187 ui::PAGE_TRANSITION_LINK, false));
194 return true; 188 return true;
195 } 189 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698