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

Side by Side Diff: chrome/browser/ui/autologin_infobar_delegate.cc

Issue 7590023: Remove use of wstring from autologin infobar. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/autologin_infobar_delegate.h" 5 #include "chrome/browser/ui/autologin_infobar_delegate.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_split.h" 10 #include "base/string_split.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 gfx::Image* AutoLoginInfoBarDelegate::GetIcon() const { 258 gfx::Image* AutoLoginInfoBarDelegate::GetIcon() const {
259 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 259 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
260 IDR_INFOBAR_AUTOLOGIN); 260 IDR_INFOBAR_AUTOLOGIN);
261 } 261 }
262 262
263 InfoBarDelegate::Type AutoLoginInfoBarDelegate::GetInfoBarType() const { 263 InfoBarDelegate::Type AutoLoginInfoBarDelegate::GetInfoBarType() const {
264 return PAGE_ACTION_TYPE; 264 return PAGE_ACTION_TYPE;
265 } 265 }
266 266
267 string16 AutoLoginInfoBarDelegate::GetMessageText() const { 267 string16 AutoLoginInfoBarDelegate::GetMessageText() const {
268 string16 format = l10n_util::GetStringUTF16(IDS_AUTOLOGIN_INFOBAR_MESSAGE); 268 return l10n_util::GetStringFUTF16(IDS_AUTOLOGIN_INFOBAR_MESSAGE,
269 std::wstring format_wide = UTF16ToWide(format); 269 UTF8ToUTF16(account_));
270 std::wstring account_wide = UTF8ToWide(account_);
271 std::wstring message = base::StringPrintf(format_wide.c_str(), // NOLINT
272 account_wide.c_str());
273 return WideToUTF16(message);
274 } 270 }
275 271
276 int AutoLoginInfoBarDelegate::GetButtons() const { 272 int AutoLoginInfoBarDelegate::GetButtons() const {
277 return BUTTON_OK | BUTTON_CANCEL; 273 return BUTTON_OK | BUTTON_CANCEL;
278 } 274 }
279 275
280 string16 AutoLoginInfoBarDelegate::GetButtonLabel( 276 string16 AutoLoginInfoBarDelegate::GetButtonLabel(
281 InfoBarButton button) const { 277 InfoBarButton button) const {
282 return l10n_util::GetStringUTF16(BUTTON_OK == button ? 278 return l10n_util::GetStringUTF16(BUTTON_OK == button ?
283 IDS_AUTOLOGIN_INFOBAR_OK_BUTTON : IDS_AUTOLOGIN_INFOBAR_CANCEL_BUTTON); 279 IDS_AUTOLOGIN_INFOBAR_OK_BUTTON : IDS_AUTOLOGIN_INFOBAR_CANCEL_BUTTON);
284 } 280 }
285 281
286 bool AutoLoginInfoBarDelegate::Accept() { 282 bool AutoLoginInfoBarDelegate::Accept() {
287 // AutoLoginRedirector auto deletes itself. 283 // AutoLoginRedirector auto deletes itself.
288 new AutoLoginRedirector(tab_contents_wrapper_, args_); 284 new AutoLoginRedirector(tab_contents_wrapper_, args_);
289 return true; 285 return true;
290 } 286 }
291 287
292 bool AutoLoginInfoBarDelegate::Cancel() { 288 bool AutoLoginInfoBarDelegate::Cancel() {
293 PrefService* user_prefs = tab_contents_wrapper_->profile()->GetPrefs(); 289 PrefService* user_prefs = tab_contents_wrapper_->profile()->GetPrefs();
294 user_prefs->SetBoolean(prefs::kAutologinEnabled, false); 290 user_prefs->SetBoolean(prefs::kAutologinEnabled, false);
295 user_prefs->ScheduleSavePersistentPrefs(); 291 user_prefs->ScheduleSavePersistentPrefs();
296 return true; 292 return true;
297 } 293 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698