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

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

Issue 112913004: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/javascript_dialog_manager.h" 5 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void ChromeJavaScriptDialogManager::RunBeforeUnloadDialog( 202 void ChromeJavaScriptDialogManager::RunBeforeUnloadDialog(
203 WebContents* web_contents, 203 WebContents* web_contents,
204 const base::string16& message_text, 204 const base::string16& message_text,
205 bool is_reload, 205 bool is_reload,
206 const DialogClosedCallback& callback) { 206 const DialogClosedCallback& callback) {
207 const base::string16 title = l10n_util::GetStringUTF16(is_reload ? 207 const base::string16 title = l10n_util::GetStringUTF16(is_reload ?
208 IDS_BEFORERELOAD_MESSAGEBOX_TITLE : IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE); 208 IDS_BEFORERELOAD_MESSAGEBOX_TITLE : IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE);
209 const base::string16 footer = l10n_util::GetStringUTF16(is_reload ? 209 const base::string16 footer = l10n_util::GetStringUTF16(is_reload ?
210 IDS_BEFORERELOAD_MESSAGEBOX_FOOTER : IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER); 210 IDS_BEFORERELOAD_MESSAGEBOX_FOOTER : IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER);
211 211
212 base::string16 full_message = message_text + ASCIIToUTF16("\n\n") + footer; 212 base::string16 full_message =
213 message_text + base::ASCIIToUTF16("\n\n") + footer;
213 214
214 const Extension* extension = GetExtensionForWebContents(web_contents); 215 const Extension* extension = GetExtensionForWebContents(web_contents);
215 if (extension) 216 if (extension)
216 IncrementLazyKeepaliveCount(extension, web_contents); 217 IncrementLazyKeepaliveCount(extension, web_contents);
217 218
218 AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog( 219 AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog(
219 web_contents, 220 web_contents,
220 &javascript_dialog_extra_data_, 221 &javascript_dialog_extra_data_,
221 title, 222 title,
222 content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM, 223 content::JAVASCRIPT_MESSAGE_TYPE_CONFIRM,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 bool is_alert) { 265 bool is_alert) {
265 // If the URL hasn't any host, return the default string. 266 // If the URL hasn't any host, return the default string.
266 if (!origin_url.has_host()) { 267 if (!origin_url.has_host()) {
267 return l10n_util::GetStringUTF16( 268 return l10n_util::GetStringUTF16(
268 is_alert ? IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE 269 is_alert ? IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE
269 : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE); 270 : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE);
270 } 271 }
271 272
272 const Extension* extension = GetExtensionForWebContents(web_contents); 273 const Extension* extension = GetExtensionForWebContents(web_contents);
273 if (extension) 274 if (extension)
274 return UTF8ToUTF16(extension->name()); 275 return base::UTF8ToUTF16(extension->name());
275 276
276 // Otherwise, return the formatted URL. 277 // Otherwise, return the formatted URL.
277 // In this case, force URL to have LTR directionality. 278 // In this case, force URL to have LTR directionality.
278 base::string16 url_string = net::FormatUrl(origin_url, accept_lang); 279 base::string16 url_string = net::FormatUrl(origin_url, accept_lang);
279 return l10n_util::GetStringFUTF16( 280 return l10n_util::GetStringFUTF16(
280 is_alert ? IDS_JAVASCRIPT_ALERT_TITLE 281 is_alert ? IDS_JAVASCRIPT_ALERT_TITLE
281 : IDS_JAVASCRIPT_MESSAGEBOX_TITLE, 282 : IDS_JAVASCRIPT_MESSAGEBOX_TITLE,
282 base::i18n::GetDisplayStringInLTRDirectionality(url_string)); 283 base::i18n::GetDisplayStringInLTRDirectionality(url_string));
283 } 284 }
284 285
(...skipping 23 matching lines...) Expand all
308 DecrementLazyKeepaliveCount(extension, web_contents); 309 DecrementLazyKeepaliveCount(extension, web_contents);
309 310
310 callback.Run(success, user_input); 311 callback.Run(success, user_input);
311 } 312 }
312 313
313 } // namespace 314 } // namespace
314 315
315 content::JavaScriptDialogManager* GetJavaScriptDialogManagerInstance() { 316 content::JavaScriptDialogManager* GetJavaScriptDialogManagerInstance() {
316 return ChromeJavaScriptDialogManager::GetInstance(); 317 return ChromeJavaScriptDialogManager::GetInstance();
317 } 318 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698