| OLD | NEW |
| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (!origin_url.has_host()) { | 244 if (!origin_url.has_host()) { |
| 245 return l10n_util::GetStringUTF16( | 245 return l10n_util::GetStringUTF16( |
| 246 is_alert ? IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE | 246 is_alert ? IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE |
| 247 : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE); | 247 : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE); |
| 248 } | 248 } |
| 249 | 249 |
| 250 // If the URL is a chrome extension one, return the extension name. | 250 // If the URL is a chrome extension one, return the extension name. |
| 251 if (extension_host_) { | 251 if (extension_host_) { |
| 252 const extensions::Extension* extension = extension_host_-> | 252 const extensions::Extension* extension = extension_host_-> |
| 253 profile()->GetExtensionService()->extensions()-> | 253 profile()->GetExtensionService()->extensions()-> |
| 254 GetExtensionOrAppByURL(ExtensionURLInfo(origin_url)); | 254 GetExtensionOrAppByURL(origin_url); |
| 255 if (extension) { | 255 if (extension) { |
| 256 return UTF8ToUTF16(base::StringPiece(extension->name())); | 256 return UTF8ToUTF16(base::StringPiece(extension->name())); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 // Otherwise, return the formatted URL. | 260 // Otherwise, return the formatted URL. |
| 261 // In this case, force URL to have LTR directionality. | 261 // In this case, force URL to have LTR directionality. |
| 262 string16 url_string = net::FormatUrl(origin_url, accept_lang); | 262 string16 url_string = net::FormatUrl(origin_url, accept_lang); |
| 263 return l10n_util::GetStringFUTF16( | 263 return l10n_util::GetStringFUTF16( |
| 264 is_alert ? IDS_JAVASCRIPT_ALERT_TITLE | 264 is_alert ? IDS_JAVASCRIPT_ALERT_TITLE |
| (...skipping 26 matching lines...) Expand all Loading... |
| 291 } // namespace | 291 } // namespace |
| 292 | 292 |
| 293 content::JavaScriptDialogManager* GetJavaScriptDialogManagerInstance() { | 293 content::JavaScriptDialogManager* GetJavaScriptDialogManagerInstance() { |
| 294 return ChromeJavaScriptDialogManager::GetInstance(); | 294 return ChromeJavaScriptDialogManager::GetInstance(); |
| 295 } | 295 } |
| 296 | 296 |
| 297 content::JavaScriptDialogManager* CreateJavaScriptDialogManagerInstance( | 297 content::JavaScriptDialogManager* CreateJavaScriptDialogManagerInstance( |
| 298 extensions::ExtensionHost* extension_host) { | 298 extensions::ExtensionHost* extension_host) { |
| 299 return new ChromeJavaScriptDialogManager(extension_host); | 299 return new ChromeJavaScriptDialogManager(extension_host); |
| 300 } | 300 } |
| OLD | NEW |