| 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/message_box_handler.h" | 5 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 bool is_alert) { | 220 bool is_alert) { |
| 221 // If the URL hasn't any host, return the default string. | 221 // If the URL hasn't any host, return the default string. |
| 222 if (!origin_url.has_host()) { | 222 if (!origin_url.has_host()) { |
| 223 return l10n_util::GetStringUTF16( | 223 return l10n_util::GetStringUTF16( |
| 224 is_alert ? IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE | 224 is_alert ? IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE |
| 225 : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE); | 225 : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE); |
| 226 } | 226 } |
| 227 | 227 |
| 228 // If the URL is a chrome extension one, return the extension name. | 228 // If the URL is a chrome extension one, return the extension name. |
| 229 if (extension_host_) { | 229 if (extension_host_) { |
| 230 const Extension* extension = extension_host_-> | 230 const extensions::Extension* extension = extension_host_-> |
| 231 profile()->GetExtensionService()->extensions()-> | 231 profile()->GetExtensionService()->extensions()-> |
| 232 GetExtensionOrAppByURL(ExtensionURLInfo(origin_url)); | 232 GetExtensionOrAppByURL(ExtensionURLInfo(origin_url)); |
| 233 if (extension) { | 233 if (extension) { |
| 234 return UTF8ToUTF16(base::StringPiece(extension->name())); | 234 return UTF8ToUTF16(base::StringPiece(extension->name())); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 // Otherwise, return the formatted URL. | 238 // Otherwise, return the formatted URL. |
| 239 // In this case, force URL to have LTR directionality. | 239 // In this case, force URL to have LTR directionality. |
| 240 string16 url_string = net::FormatUrl(origin_url, accept_lang); | 240 string16 url_string = net::FormatUrl(origin_url, accept_lang); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 267 //------------------------------------------------------------------------------ | 267 //------------------------------------------------------------------------------ |
| 268 | 268 |
| 269 content::JavaScriptDialogCreator* GetJavaScriptDialogCreatorInstance() { | 269 content::JavaScriptDialogCreator* GetJavaScriptDialogCreatorInstance() { |
| 270 return ChromeJavaScriptDialogCreator::GetInstance(); | 270 return ChromeJavaScriptDialogCreator::GetInstance(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 content::JavaScriptDialogCreator* CreateJavaScriptDialogCreatorInstance( | 273 content::JavaScriptDialogCreator* CreateJavaScriptDialogCreatorInstance( |
| 274 ExtensionHost* extension_host) { | 274 ExtensionHost* extension_host) { |
| 275 return new ChromeJavaScriptDialogCreator(extension_host); | 275 return new ChromeJavaScriptDialogCreator(extension_host); |
| 276 } | 276 } |
| OLD | NEW |