| 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/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" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "components/app_modal_dialogs/app_modal_dialog.h" | 12 #include "components/app_modal_dialogs/app_modal_dialog.h" |
| 13 #include "components/app_modal_dialogs/app_modal_dialog_queue.h" | 13 #include "components/app_modal_dialogs/app_modal_dialog_queue.h" |
| 14 #include "components/app_modal_dialogs/javascript_app_modal_dialog.h" | 14 #include "components/app_modal_dialogs/javascript_app_modal_dialog.h" |
| 15 #include "components/app_modal_dialogs/native_app_modal_dialog.h" | 15 #include "components/app_modal_dialogs/native_app_modal_dialog.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/common/content_client.h" | 17 #include "content/public/common/content_client.h" |
| 18 #include "content/public/common/javascript_message_type.h" | 18 #include "content/public/common/javascript_message_type.h" |
| 19 #include "grit/components_strings.h" | 19 #include "grit/components_strings.h" |
| 20 #include "net/base/net_util.h" | 20 #include "net/base/net_util.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 22 | 22 |
| 23 #if defined(ENABLE_EXTENSIONS) | 23 #if defined(ENABLE_EXTENSIONS) |
| 24 #include "extensions/browser/extension_system.h" | |
| 25 #include "extensions/browser/process_manager.h" | 24 #include "extensions/browser/process_manager.h" |
| 25 #include "extensions/common/extension.h" |
| 26 #endif // defined(ENABLE_EXTENSIONS) | 26 #endif // defined(ENABLE_EXTENSIONS) |
| 27 | 27 |
| 28 using content::BrowserContext; | 28 using content::BrowserContext; |
| 29 using content::JavaScriptDialogManager; | 29 using content::JavaScriptDialogManager; |
| 30 using content::WebContents; | 30 using content::WebContents; |
| 31 | 31 |
| 32 #if defined(ENABLE_EXTENSIONS) | 32 #if defined(ENABLE_EXTENSIONS) |
| 33 using extensions::Extension; | 33 using extensions::Extension; |
| 34 #endif // defined(ENABLE_EXTENSIONS) | 34 #endif // defined(ENABLE_EXTENSIONS) |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 | 37 |
| 38 #if defined(ENABLE_EXTENSIONS) | 38 #if defined(ENABLE_EXTENSIONS) |
| 39 // Returns the ProcessManager for the browser context from |web_contents|. | 39 // Returns the ProcessManager for the browser context from |web_contents|. |
| 40 extensions::ProcessManager* GetExtensionsProcessManager( | 40 extensions::ProcessManager* GetExtensionsProcessManager( |
| 41 WebContents* web_contents) { | 41 WebContents* web_contents) { |
| 42 return extensions::ExtensionSystem::Get( | 42 return extensions::ProcessManager::Get(web_contents->GetBrowserContext()); |
| 43 web_contents->GetBrowserContext())->process_manager(); | |
| 44 } | 43 } |
| 45 | 44 |
| 46 // Returns the extension associated with |web_contents| or NULL if there is no | 45 // Returns the extension associated with |web_contents| or NULL if there is no |
| 47 // associated extension (or extensions are not supported). | 46 // associated extension (or extensions are not supported). |
| 48 const Extension* GetExtensionForWebContents(WebContents* web_contents) { | 47 const Extension* GetExtensionForWebContents(WebContents* web_contents) { |
| 49 extensions::ProcessManager* pm = GetExtensionsProcessManager(web_contents); | 48 extensions::ProcessManager* pm = GetExtensionsProcessManager(web_contents); |
| 50 return pm->GetExtensionForRenderViewHost(web_contents->GetRenderViewHost()); | 49 return pm->GetExtensionForRenderViewHost(web_contents->GetRenderViewHost()); |
| 51 } | 50 } |
| 52 #endif // defined(ENABLE_EXTENSIONS) | 51 #endif // defined(ENABLE_EXTENSIONS) |
| 53 | 52 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 DecrementLazyKeepaliveCount(web_contents); | 313 DecrementLazyKeepaliveCount(web_contents); |
| 315 | 314 |
| 316 callback.Run(success, user_input); | 315 callback.Run(success, user_input); |
| 317 } | 316 } |
| 318 | 317 |
| 319 } // namespace | 318 } // namespace |
| 320 | 319 |
| 321 content::JavaScriptDialogManager* GetJavaScriptDialogManagerInstance() { | 320 content::JavaScriptDialogManager* GetJavaScriptDialogManagerInstance() { |
| 322 return ChromeJavaScriptDialogManager::GetInstance(); | 321 return ChromeJavaScriptDialogManager::GetInstance(); |
| 323 } | 322 } |
| OLD | NEW |