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

Side by Side Diff: chrome/browser/ui/app_modal_dialogs/message_box_handler.cc

Issue 6044006: Remove wstring from l10n_util. Part 3.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 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
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/ui/app_modal_dialogs/message_box_handler.h" 5 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "app/message_box_flags.h" 8 #include "app/message_box_flags.h"
9 #include "app/text_elider.h" 9 #include "app/text_elider.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 15 matching lines...) Expand all
26 bool is_alert, 26 bool is_alert,
27 const GURL& frame_url) { 27 const GURL& frame_url) {
28 ExtensionService* extensions_service = profile->GetExtensionService(); 28 ExtensionService* extensions_service = profile->GetExtensionService();
29 if (extensions_service) { 29 if (extensions_service) {
30 const Extension* extension = 30 const Extension* extension =
31 extensions_service->GetExtensionByURL(frame_url); 31 extensions_service->GetExtensionByURL(frame_url);
32 if (!extension) 32 if (!extension)
33 extension = extensions_service->GetExtensionByWebExtent(frame_url); 33 extension = extensions_service->GetExtensionByWebExtent(frame_url);
34 34
35 if (extension && (extension->location() == Extension::COMPONENT)) { 35 if (extension && (extension->location() == Extension::COMPONENT)) {
36 return l10n_util::GetString(IDS_PRODUCT_NAME); 36 return UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
37 } else if (extension && !extension->name().empty()) { 37 } else if (extension && !extension->name().empty()) {
38 return UTF8ToWide(extension->name()); 38 return UTF8ToWide(extension->name());
39 } 39 }
40 } 40 }
41 if (!frame_url.has_host()) { 41 if (!frame_url.has_host()) {
42 return l10n_util::GetString( 42 return UTF16ToWideHack(l10n_util::GetStringUTF16(
43 is_alert ? IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE 43 is_alert ? IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE
44 : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE); 44 : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE));
45 } 45 }
46 46
47 // TODO(brettw) it should be easier than this to do the correct language 47 // TODO(brettw) it should be easier than this to do the correct language
48 // handling without getting the accept language from the profile. 48 // handling without getting the accept language from the profile.
49 string16 base_address = gfx::ElideUrl(frame_url.GetOrigin(), 49 string16 base_address = gfx::ElideUrl(frame_url.GetOrigin(),
50 gfx::Font(), 0, 50 gfx::Font(), 0,
51 UTF8ToWide(profile->GetPrefs()->GetString(prefs::kAcceptLanguages))); 51 UTF8ToWide(profile->GetPrefs()->GetString(prefs::kAcceptLanguages)));
52 52
53 // Force URL to have LTR directionality. 53 // Force URL to have LTR directionality.
54 base_address = base::i18n::GetDisplayStringInLTRDirectionality( 54 base_address = base::i18n::GetDisplayStringInLTRDirectionality(
(...skipping 16 matching lines...) Expand all
71 bool is_alert = dialog_flags == MessageBoxFlags::kIsJavascriptAlert; 71 bool is_alert = dialog_flags == MessageBoxFlags::kIsJavascriptAlert;
72 std::wstring title = GetTitle(profile, is_alert, frame_url); 72 std::wstring title = GetTitle(profile, is_alert, frame_url);
73 AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog( 73 AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog(
74 delegate, title, dialog_flags, message_text, default_prompt_text, 74 delegate, title, dialog_flags, message_text, default_prompt_text,
75 display_suppress_checkbox, false, reply_msg)); 75 display_suppress_checkbox, false, reply_msg));
76 } 76 }
77 77
78 void RunBeforeUnloadDialog(TabContents* tab_contents, 78 void RunBeforeUnloadDialog(TabContents* tab_contents,
79 const std::wstring& message_text, 79 const std::wstring& message_text,
80 IPC::Message* reply_msg) { 80 IPC::Message* reply_msg) {
81 std::wstring full_message = 81 std::wstring full_message = message_text + L"\n\n" + UTF16ToWideHack(
82 message_text + L"\n\n" + 82 l10n_util::GetStringUTF16(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER));
83 l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER);
84 AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog( 83 AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog(
85 tab_contents, l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE), 84 tab_contents,
86 MessageBoxFlags::kIsJavascriptConfirm, message_text, std::wstring(), 85 UTF16ToWideHack(
87 false, true, reply_msg)); 86 l10n_util::GetStringUTF16(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE)),
viettrungluu 2010/12/29 19:04:15 Ditto indentation nit.
Avi (use Gerrit) 2010/12/29 19:40:49 Done.
87 MessageBoxFlags::kIsJavascriptConfirm,
88 message_text,
89 std::wstring(),
90 false,
91 true,
92 reply_msg));
88 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698