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

Side by Side Diff: chrome/browser/tab_contents/tab_contents.cc

Issue 3127009: Convert infobar APIs to UTF-16. (Closed)
Patch Set: works Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/tab_contents/tab_contents.h" 5 #include "chrome/browser/tab_contents/tab_contents.h"
6 6
7 #if defined(OS_CHROMEOS) 7 #if defined(OS_CHROMEOS)
8 // For GdkScreen 8 // For GdkScreen
9 #include <gdk/gdk.h> 9 #include <gdk/gdk.h>
10 #endif // defined(OS_CHROMEOS) 10 #endif // defined(OS_CHROMEOS)
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 tab_contents_(tab_contents), 246 tab_contents_(tab_contents),
247 name_(name), 247 name_(name),
248 update_url_(update_url) { 248 update_url_(update_url) {
249 tab_contents->AddInfoBar(this); 249 tab_contents->AddInfoBar(this);
250 } 250 }
251 251
252 virtual int GetButtons() const { 252 virtual int GetButtons() const {
253 return BUTTON_OK | BUTTON_CANCEL | BUTTON_OK_DEFAULT; 253 return BUTTON_OK | BUTTON_CANCEL | BUTTON_OK_DEFAULT;
254 } 254 }
255 255
256 virtual std::wstring GetButtonLabel(InfoBarButton button) const { 256 virtual string16 GetButtonLabel(InfoBarButton button) const {
257 if (button == BUTTON_CANCEL) 257 if (button == BUTTON_CANCEL)
258 return l10n_util::GetString(IDS_PLUGIN_ENABLE_TEMPORARILY); 258 return l10n_util::GetStringUTF16(IDS_PLUGIN_ENABLE_TEMPORARILY);
259 if (button == BUTTON_OK) 259 if (button == BUTTON_OK)
260 return l10n_util::GetString(IDS_PLUGIN_UPDATE); 260 return l10n_util::GetStringUTF16(IDS_PLUGIN_UPDATE);
261 return ConfirmInfoBarDelegate::GetButtonLabel(button); 261 return ConfirmInfoBarDelegate::GetButtonLabel(button);
262 } 262 }
263 263
264 virtual std::wstring GetMessageText() const { 264 virtual string16 GetMessageText() const {
265 return UTF16ToWide(l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED_PROMPT, 265 return l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED_PROMPT, name_);
266 name_));
267 } 266 }
268 267
269 virtual std::wstring GetLinkText() { 268 virtual string16 GetLinkText() {
270 return l10n_util::GetString(IDS_LEARN_MORE); 269 return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
271 } 270 }
272 271
273 virtual SkBitmap* GetIcon() const { 272 virtual SkBitmap* GetIcon() const {
274 return ResourceBundle::GetSharedInstance().GetBitmapNamed( 273 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
275 IDR_INFOBAR_PLUGIN_INSTALL); 274 IDR_INFOBAR_PLUGIN_INSTALL);
276 } 275 }
277 276
278 virtual bool Accept() { 277 virtual bool Accept() {
279 tab_contents_->OpenURL(update_url_, GURL(), 278 tab_contents_->OpenURL(update_url_, GURL(),
280 CURRENT_TAB, PageTransition::LINK); 279 CURRENT_TAB, PageTransition::LINK);
(...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 plugin_name.erase(plugin_name.length() - plugin_extension.length()); 1985 plugin_name.erase(plugin_name.length() - plugin_extension.length());
1987 #endif // OS_MACOSX 1986 #endif // OS_MACOSX
1988 } 1987 }
1989 } 1988 }
1990 #else 1989 #else
1991 NOTIMPLEMENTED() << " convert plugin path to plugin name"; 1990 NOTIMPLEMENTED() << " convert plugin path to plugin name";
1992 #endif 1991 #endif
1993 SkBitmap* crash_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed( 1992 SkBitmap* crash_icon = ResourceBundle::GetSharedInstance().GetBitmapNamed(
1994 IDR_INFOBAR_PLUGIN_CRASHED); 1993 IDR_INFOBAR_PLUGIN_CRASHED);
1995 AddInfoBar(new SimpleAlertInfoBarDelegate( 1994 AddInfoBar(new SimpleAlertInfoBarDelegate(
1996 this, l10n_util::GetStringF(IDS_PLUGIN_CRASHED_PROMPT, plugin_name), 1995 this, l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT,
1996 WideToUTF16Hack(plugin_name)),
1997 crash_icon, true)); 1997 crash_icon, true));
1998 } 1998 }
1999 1999
2000 void TabContents::OnCrashedWorker() { 2000 void TabContents::OnCrashedWorker() {
2001 AddInfoBar(new SimpleAlertInfoBarDelegate( 2001 AddInfoBar(new SimpleAlertInfoBarDelegate(
2002 this, l10n_util::GetString(IDS_WEBWORKER_CRASHED_PROMPT), 2002 this, l10n_util::GetStringUTF16(IDS_WEBWORKER_CRASHED_PROMPT),
2003 NULL, true)); 2003 NULL, true));
2004 } 2004 }
2005 2005
2006 void TabContents::OnDidGetApplicationInfo( 2006 void TabContents::OnDidGetApplicationInfo(
2007 int32 page_id, 2007 int32 page_id,
2008 const webkit_glue::WebApplicationInfo& info) { 2008 const webkit_glue::WebApplicationInfo& info) {
2009 web_app_info_ = info; 2009 web_app_info_ = info;
2010 2010
2011 if (delegate()) 2011 if (delegate())
2012 delegate()->OnDidGetApplicationInfo(this, page_id); 2012 delegate()->OnDidGetApplicationInfo(this, page_id);
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2861 2861
2862 void TabContents::OnIgnoredUIEvent() { 2862 void TabContents::OnIgnoredUIEvent() {
2863 if (constrained_window_count()) { 2863 if (constrained_window_count()) {
2864 ConstrainedWindow* window = *constrained_window_begin(); 2864 ConstrainedWindow* window = *constrained_window_begin();
2865 window->FocusConstrainedWindow(); 2865 window->FocusConstrainedWindow();
2866 } 2866 }
2867 } 2867 }
2868 2868
2869 void TabContents::OnJSOutOfMemory() { 2869 void TabContents::OnJSOutOfMemory() {
2870 AddInfoBar(new SimpleAlertInfoBarDelegate( 2870 AddInfoBar(new SimpleAlertInfoBarDelegate(
2871 this, l10n_util::GetString(IDS_JS_OUT_OF_MEMORY_PROMPT), NULL, true)); 2871 this, l10n_util::GetStringUTF16(IDS_JS_OUT_OF_MEMORY_PROMPT),
2872 NULL, true));
2872 } 2873 }
2873 2874
2874 void TabContents::OnCrossSiteResponse(int new_render_process_host_id, 2875 void TabContents::OnCrossSiteResponse(int new_render_process_host_id,
2875 int new_request_id) { 2876 int new_request_id) {
2876 // Allows the TabContents to react when a cross-site response is ready to be 2877 // Allows the TabContents to react when a cross-site response is ready to be
2877 // delivered to a pending RenderViewHost. We must first run the onunload 2878 // delivered to a pending RenderViewHost. We must first run the onunload
2878 // handler of the old RenderViewHost before we can allow it to proceed. 2879 // handler of the old RenderViewHost before we can allow it to proceed.
2879 render_manager_.OnCrossSiteResponse(new_render_process_host_id, 2880 render_manager_.OnCrossSiteResponse(new_render_process_host_id,
2880 new_request_id); 2881 new_request_id);
2881 } 2882 }
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
3239 3240
3240 // Begin ConfirmInfoBarDelegate implementation. 3241 // Begin ConfirmInfoBarDelegate implementation.
3241 virtual void InfoBarClosed() { 3242 virtual void InfoBarClosed() {
3242 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse", 3243 UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse",
3243 infobar_response_, NUM_RESPONSE_TYPES); 3244 infobar_response_, NUM_RESPONSE_TYPES);
3244 delete this; 3245 delete this;
3245 } 3246 }
3246 3247
3247 virtual Type GetInfoBarType() { return PAGE_ACTION_TYPE; } 3248 virtual Type GetInfoBarType() { return PAGE_ACTION_TYPE; }
3248 3249
3249 virtual std::wstring GetMessageText() const { 3250 virtual string16 GetMessageText() const {
3250 return l10n_util::GetString(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT); 3251 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_PASSWORD_PROMPT);
3251 } 3252 }
3252 3253
3253 virtual SkBitmap* GetIcon() const { 3254 virtual SkBitmap* GetIcon() const {
3254 return ResourceBundle::GetSharedInstance().GetBitmapNamed( 3255 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
3255 IDR_INFOBAR_SAVE_PASSWORD); 3256 IDR_INFOBAR_SAVE_PASSWORD);
3256 } 3257 }
3257 3258
3258 virtual int GetButtons() const { 3259 virtual int GetButtons() const {
3259 return BUTTON_OK | BUTTON_CANCEL; 3260 return BUTTON_OK | BUTTON_CANCEL;
3260 } 3261 }
3261 3262
3262 virtual std::wstring GetButtonLabel(InfoBarButton button) const { 3263 virtual string16 GetButtonLabel(InfoBarButton button) const {
3263 if (button == BUTTON_OK) 3264 if (button == BUTTON_OK)
3264 return l10n_util::GetString(IDS_PASSWORD_MANAGER_SAVE_BUTTON); 3265 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON);
3265 if (button == BUTTON_CANCEL) 3266 if (button == BUTTON_CANCEL)
3266 return l10n_util::GetString(IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON); 3267 return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON);
3267 NOTREACHED(); 3268 NOTREACHED();
3268 return std::wstring(); 3269 return string16();
3269 } 3270 }
3270 3271
3271 virtual bool Accept() { 3272 virtual bool Accept() {
3272 DCHECK(form_to_save_.get()); 3273 DCHECK(form_to_save_.get());
3273 form_to_save_->Save(); 3274 form_to_save_->Save();
3274 infobar_response_ = REMEMBER_PASSWORD; 3275 infobar_response_ = REMEMBER_PASSWORD;
3275 return true; 3276 return true;
3276 } 3277 }
3277 3278
3278 virtual bool Cancel() { 3279 virtual bool Cancel() {
(...skipping 30 matching lines...) Expand all
3309 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); 3310 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save));
3310 } 3311 }
3311 3312
3312 Profile* TabContents::GetProfileForPasswordManager() { 3313 Profile* TabContents::GetProfileForPasswordManager() {
3313 return profile(); 3314 return profile();
3314 } 3315 }
3315 3316
3316 bool TabContents::DidLastPageLoadEncounterSSLErrors() { 3317 bool TabContents::DidLastPageLoadEncounterSSLErrors() {
3317 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); 3318 return controller().ssl_manager()->ProcessedSSLErrorFromRequest();
3318 } 3319 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698