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