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

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

Issue 1723583004: CREDENTIAL: Convert federations from URLs to origins throughout. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iOS2 Created 4 years, 10 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 <utility> 7 #include <utility>
8 8
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/sync/profile_sync_service_factory.h" 12 #include "chrome/browser/sync/profile_sync_service_factory.h"
13 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h" 13 #include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
14 #include "chrome/grit/chromium_strings.h" 14 #include "chrome/grit/chromium_strings.h"
15 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
16 #include "components/browser_sync/browser/profile_sync_service.h" 16 #include "components/browser_sync/browser/profile_sync_service.h"
17 #include "components/infobars/core/infobar.h" 17 #include "components/infobars/core/infobar.h"
18 #include "components/password_manager/core/browser/password_bubble_experiment.h" 18 #include "components/password_manager/core/browser/password_bubble_experiment.h"
19 #include "components/password_manager/core/browser/password_manager_client.h" 19 #include "components/password_manager/core/browser/password_manager_client.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "grit/theme_resources.h" 21 #include "grit/theme_resources.h"
22 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
23 #include "url/origin.h"
23 24
24 // static 25 // static
25 void SavePasswordInfoBarDelegate::Create( 26 void SavePasswordInfoBarDelegate::Create(
26 content::WebContents* web_contents, 27 content::WebContents* web_contents,
27 scoped_ptr<password_manager::PasswordFormManager> form_to_save, 28 scoped_ptr<password_manager::PasswordFormManager> form_to_save,
28 const std::string& uma_histogram_suffix) { 29 const std::string& uma_histogram_suffix) {
29 Profile* profile = 30 Profile* profile =
30 Profile::FromBrowserContext(web_contents->GetBrowserContext()); 31 Profile::FromBrowserContext(web_contents->GetBrowserContext());
31 sync_driver::SyncService* sync_service = 32 sync_driver::SyncService* sync_service =
32 ProfileSyncServiceFactory::GetForProfile(profile); 33 ProfileSyncServiceFactory::GetForProfile(profile);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 should_show_first_run_experience_(should_show_first_run_experience), 89 should_show_first_run_experience_(should_show_first_run_experience),
89 web_contents_(web_contents) { 90 web_contents_(web_contents) {
90 if (!uma_histogram_suffix_.empty()) { 91 if (!uma_histogram_suffix_.empty()) {
91 password_manager::metrics_util::LogUMAHistogramBoolean( 92 password_manager::metrics_util::LogUMAHistogramBoolean(
92 "PasswordManager.SavePasswordPromptDisplayed_" + uma_histogram_suffix_, 93 "PasswordManager.SavePasswordPromptDisplayed_" + uma_histogram_suffix_,
93 true); 94 true);
94 } 95 }
95 base::string16 message; 96 base::string16 message;
96 gfx::Range message_link_range = gfx::Range(); 97 gfx::Range message_link_range = gfx::Range();
97 PasswordTittleType type = 98 PasswordTittleType type =
98 form_to_save_->pending_credentials().federation_url.is_empty() 99 form_to_save_->pending_credentials().federation_origin.unique()
99 ? PasswordTittleType::SAVE_PASSWORD 100 ? PasswordTittleType::SAVE_PASSWORD
100 : PasswordTittleType::SAVE_ACCOUNT; 101 : PasswordTittleType::UPDATE_PASSWORD;
melandory 2016/03/11 10:01:07 Sad story about the fix which didn't survive https
101 GetSavePasswordDialogTitleTextAndLinkRange( 102 GetSavePasswordDialogTitleTextAndLinkRange(
102 web_contents->GetVisibleURL(), form_to_save_->observed_form().origin, 103 web_contents->GetVisibleURL(), form_to_save_->observed_form().origin,
103 is_smartlock_branding_enabled, type, 104 is_smartlock_branding_enabled, type,
104 &message, &message_link_range); 105 &message, &message_link_range);
105 SetMessage(message); 106 SetMessage(message);
106 SetMessageLinkRange(message_link_range); 107 SetMessageLinkRange(message_link_range);
107 } 108 }
108 109
109 base::string16 SavePasswordInfoBarDelegate::GetFirstRunExperienceMessage() { 110 base::string16 SavePasswordInfoBarDelegate::GetFirstRunExperienceMessage() {
110 return should_show_first_run_experience_ 111 return should_show_first_run_experience_
(...skipping 25 matching lines...) Expand all
136 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD; 137 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD;
137 return true; 138 return true;
138 } 139 }
139 140
140 bool SavePasswordInfoBarDelegate::Cancel() { 141 bool SavePasswordInfoBarDelegate::Cancel() {
141 DCHECK(form_to_save_.get()); 142 DCHECK(form_to_save_.get());
142 form_to_save_->PermanentlyBlacklist(); 143 form_to_save_->PermanentlyBlacklist();
143 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD; 144 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD;
144 return true; 145 return true;
145 } 146 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698