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

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

Issue 1520543004: Add method for identifying different InfoBars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit again Created 4 years, 11 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"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 SetMessageLinkRange(message_link_range); 116 SetMessageLinkRange(message_link_range);
117 } 117 }
118 118
119 base::string16 SavePasswordInfoBarDelegate::GetFirstRunExperienceMessage() { 119 base::string16 SavePasswordInfoBarDelegate::GetFirstRunExperienceMessage() {
120 return should_show_first_run_experience_ 120 return should_show_first_run_experience_
121 ? l10n_util::GetStringUTF16( 121 ? l10n_util::GetStringUTF16(
122 IDS_PASSWORD_MANAGER_SAVE_PROMPT_FIRST_RUN_EXPERIENCE) 122 IDS_PASSWORD_MANAGER_SAVE_PROMPT_FIRST_RUN_EXPERIENCE)
123 : base::string16(); 123 : base::string16();
124 } 124 }
125 125
126 infobars::InfoBarDelegate::InfoBarIdentifier
127 SavePasswordInfoBarDelegate::GetIdentifier() const {
128 return SAVE_PASSWORD_INFOBAR_DELEGATE;
129 }
130
126 void SavePasswordInfoBarDelegate::InfoBarDismissed() { 131 void SavePasswordInfoBarDelegate::InfoBarDismissed() {
127 DCHECK(form_to_save_.get()); 132 DCHECK(form_to_save_.get());
128 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED; 133 infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED;
129 } 134 }
130 135
131 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel( 136 base::string16 SavePasswordInfoBarDelegate::GetButtonLabel(
132 InfoBarButton button) const { 137 InfoBarButton button) const {
133 return l10n_util::GetStringUTF16((button == BUTTON_OK) 138 return l10n_util::GetStringUTF16((button == BUTTON_OK)
134 ? IDS_PASSWORD_MANAGER_SAVE_BUTTON 139 ? IDS_PASSWORD_MANAGER_SAVE_BUTTON
135 : GetCancelButtonText(source_type_)); 140 : GetCancelButtonText(source_type_));
136 } 141 }
137 142
138 bool SavePasswordInfoBarDelegate::Accept() { 143 bool SavePasswordInfoBarDelegate::Accept() {
139 DCHECK(form_to_save_.get()); 144 DCHECK(form_to_save_.get());
140 form_to_save_->Save(); 145 form_to_save_->Save();
141 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD; 146 infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD;
142 return true; 147 return true;
143 } 148 }
144 149
145 bool SavePasswordInfoBarDelegate::Cancel() { 150 bool SavePasswordInfoBarDelegate::Cancel() {
146 DCHECK(form_to_save_.get()); 151 DCHECK(form_to_save_.get());
147 form_to_save_->PermanentlyBlacklist(); 152 form_to_save_->PermanentlyBlacklist();
148 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD; 153 infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD;
149 return true; 154 return true;
150 } 155 }
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/save_password_infobar_delegate.h ('k') | chrome/browser/pepper_broker_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698