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

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

Issue 922953002: Minor infobar cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 5 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 "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/infobars/infobar_service.h" 9 #include "chrome/browser/infobars/infobar_service.h"
10 #include "chrome/grit/chromium_strings.h" 10 #include "chrome/grit/chromium_strings.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 form_to_save_(form_to_save.Pass()), 85 form_to_save_(form_to_save.Pass()),
86 infobar_response_(password_manager::metrics_util::NO_RESPONSE), 86 infobar_response_(password_manager::metrics_util::NO_RESPONSE),
87 uma_histogram_suffix_(uma_histogram_suffix) { 87 uma_histogram_suffix_(uma_histogram_suffix) {
88 if (!uma_histogram_suffix_.empty()) { 88 if (!uma_histogram_suffix_.empty()) {
89 password_manager::metrics_util::LogUMAHistogramBoolean( 89 password_manager::metrics_util::LogUMAHistogramBoolean(
90 "PasswordManager.SavePasswordPromptDisplayed_" + uma_histogram_suffix_, 90 "PasswordManager.SavePasswordPromptDisplayed_" + uma_histogram_suffix_,
91 true); 91 true);
92 } 92 }
93 } 93 }
94 94
95 infobars::InfoBarDelegate::Type
96 SavePasswordInfoBarDelegate::GetInfoBarType() const {
97 return PAGE_ACTION_TYPE;
98 }
99
100 infobars::InfoBarDelegate::InfoBarAutomationType
101 SavePasswordInfoBarDelegate::GetInfoBarAutomationType() const {
102 return PASSWORD_INFOBAR;
103 }
104
105 int SavePasswordInfoBarDelegate::GetIconID() const {
106 return IDR_INFOBAR_SAVE_PASSWORD;
107 }
108
95 bool SavePasswordInfoBarDelegate::ShouldExpire( 109 bool SavePasswordInfoBarDelegate::ShouldExpire(
96 const NavigationDetails& details) const { 110 const NavigationDetails& details) const {
97 return !details.is_redirect && 111 return !details.is_redirect &&
98 infobars::InfoBarDelegate::ShouldExpire(details); 112 infobars::InfoBarDelegate::ShouldExpire(details);
99 } 113 }
100 114
101 int SavePasswordInfoBarDelegate::GetIconID() const { 115 void SavePasswordInfoBarDelegate::InfoBarDismissed() {
102 return IDR_INFOBAR_SAVE_PASSWORD; 116 DCHECK(form_to_save_.get());
103 } 117 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED;
104
105 infobars::InfoBarDelegate::Type SavePasswordInfoBarDelegate::GetInfoBarType()
106 const {
107 return PAGE_ACTION_TYPE;
108 } 118 }
109 119
110 base::string16 SavePasswordInfoBarDelegate::GetMessageText() const { 120 base::string16 SavePasswordInfoBarDelegate::GetMessageText() const {
111 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); 121 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT);
112 } 122 }
113 123
114 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel( 124 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel(
115 InfoBarButton button) const { 125 InfoBarButton button) const {
116 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? 126 return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
117 IDS_PASSWORD_MANAGER_SAVE_BUTTON : IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON); 127 IDS_PASSWORD_MANAGER_SAVE_BUTTON : IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON);
118 } 128 }
119 129
120 bool SavePasswordInfoBarDelegate::Accept() { 130 bool SavePasswordInfoBarDelegate::Accept() {
121 DCHECK(form_to_save_.get()); 131 DCHECK(form_to_save_.get());
122 form_to_save_->Save(); 132 form_to_save_->Save();
123 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD; 133 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD;
124 return true; 134 return true;
125 } 135 }
126 136
127 bool SavePasswordInfoBarDelegate::Cancel() { 137 bool SavePasswordInfoBarDelegate::Cancel() {
128 DCHECK(form_to_save_.get()); 138 DCHECK(form_to_save_.get());
129 form_to_save_->PermanentlyBlacklist(); 139 form_to_save_->PermanentlyBlacklist();
130 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD; 140 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD;
131 return true; 141 return true;
132 } 142 }
133
134 void SavePasswordInfoBarDelegate::InfoBarDismissed() {
135 DCHECK(form_to_save_.get());
136 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED;
137 }
138
139 infobars::InfoBarDelegate::InfoBarAutomationType
140 SavePasswordInfoBarDelegate::GetInfoBarAutomationType() const {
141 return PASSWORD_INFOBAR;
142 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/save_password_infobar_delegate.h ('k') | chrome/browser/plugins/plugin_infobar_delegates.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698