OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_host_factory.h" | 5 #include "chrome/browser/extensions/extension_host_factory.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
8 #include "chrome/browser/extensions/extension_process_manager.h" | |
9 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/extensions/extension_system.h" | 9 #include "chrome/browser/extensions/extension_system.h" |
11 #include "chrome/browser/extensions/extension_util.h" | 10 #include "chrome/browser/extensions/extension_util.h" |
12 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
| 14 #include "extensions/browser/process_manager.h" |
15 #include "extensions/common/manifest_handlers/incognito_info.h" | 15 #include "extensions/common/manifest_handlers/incognito_info.h" |
16 #include "extensions/common/view_type.h" | 16 #include "extensions/common/view_type.h" |
17 | 17 |
18 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
19 #include "chrome/browser/extensions/extension_host_mac.h" | 19 #include "chrome/browser/extensions/extension_host_mac.h" |
20 #endif | 20 #endif |
21 | 21 |
22 namespace extensions { | 22 namespace extensions { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Creates a new ExtensionHost with its associated view, grouping it in the | 26 // Creates a new ExtensionHost with its associated view, grouping it in the |
27 // appropriate SiteInstance (and therefore process) based on the URL and | 27 // appropriate SiteInstance (and therefore process) based on the URL and |
28 // profile. | 28 // profile. |
29 ExtensionHost* CreateViewHostForExtension(const Extension* extension, | 29 ExtensionHost* CreateViewHostForExtension(const Extension* extension, |
30 const GURL& url, | 30 const GURL& url, |
31 Profile* profile, | 31 Profile* profile, |
32 Browser* browser, | 32 Browser* browser, |
33 ViewType view_type) { | 33 ViewType view_type) { |
34 DCHECK(profile); | 34 DCHECK(profile); |
35 // A NULL browser may only be given for dialogs. | 35 // A NULL browser may only be given for dialogs. |
36 DCHECK(browser || view_type == VIEW_TYPE_EXTENSION_DIALOG); | 36 DCHECK(browser || view_type == VIEW_TYPE_EXTENSION_DIALOG); |
37 ExtensionProcessManager* pm = | 37 ProcessManager* pm = |
38 ExtensionSystem::Get(profile)->process_manager(); | 38 ExtensionSystem::Get(profile)->process_manager(); |
39 content::SiteInstance* site_instance = pm->GetSiteInstanceForURL(url); | 39 content::SiteInstance* site_instance = pm->GetSiteInstanceForURL(url); |
40 ExtensionHost* host = | 40 ExtensionHost* host = |
41 #if defined(OS_MACOSX) | 41 #if defined(OS_MACOSX) |
42 new ExtensionHostMac(extension, site_instance, url, view_type); | 42 new ExtensionHostMac(extension, site_instance, url, view_type); |
43 #else | 43 #else |
44 new ExtensionHost(extension, site_instance, url, view_type); | 44 new ExtensionHost(extension, site_instance, url, view_type); |
45 #endif | 45 #endif |
46 host->CreateView(browser); | 46 host->CreateView(browser); |
47 return host; | 47 return host; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 // static | 137 // static |
138 ExtensionHost* ExtensionHostFactory::CreateDialogHost(const GURL& url, | 138 ExtensionHost* ExtensionHostFactory::CreateDialogHost(const GURL& url, |
139 Profile* profile) { | 139 Profile* profile) { |
140 DCHECK(profile); | 140 DCHECK(profile); |
141 return CreateViewHost(url, profile, NULL, VIEW_TYPE_EXTENSION_DIALOG); | 141 return CreateViewHost(url, profile, NULL, VIEW_TYPE_EXTENSION_DIALOG); |
142 } | 142 } |
143 | 143 |
144 } // namespace extensions | 144 } // namespace extensions |
OLD | NEW |