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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "chrome/browser/extensions/extension_event_router.h" | 8 #include "chrome/browser/extensions/extension_event_router.h" |
9 #include "chrome/browser/extensions/extension_process_manager.h" | 9 #include "chrome/browser/extensions/extension_process_manager.h" |
10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 content::Source<content::BrowserContext>(profile)); | 141 content::Source<content::BrowserContext>(profile)); |
142 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, | 142 registrar_.Add(this, content::NOTIFICATION_DEVTOOLS_WINDOW_CLOSING, |
143 content::Source<content::BrowserContext>(profile)); | 143 content::Source<content::BrowserContext>(profile)); |
144 } | 144 } |
145 | 145 |
146 ExtensionProcessManager::~ExtensionProcessManager() { | 146 ExtensionProcessManager::~ExtensionProcessManager() { |
147 CloseBackgroundHosts(); | 147 CloseBackgroundHosts(); |
148 DCHECK(background_hosts_.empty()); | 148 DCHECK(background_hosts_.empty()); |
149 } | 149 } |
150 | 150 |
151 ExtensionHost* ExtensionProcessManager::CreateShellHost( | |
152 const Extension* extension, | |
153 const GURL& url) { | |
154 DCHECK(extension); | |
155 ExtensionHost* host = new ExtensionHost(extension, | |
156 GetSiteInstanceForURL(url), | |
157 url, | |
158 chrome::VIEW_TYPE_APP_SHELL); | |
159 host->CreateViewWithoutBrowser(); | |
160 content::WebContents* host_contents = host->host_contents(); | |
161 host_contents->GetMutableRendererPrefs()->browser_handles_all_requests = true; | |
162 host_contents->GetRenderViewHost()->SyncRendererPrefs(); | |
163 OnExtensionHostCreated(host, false /* not a background host */); | |
164 return host; | |
165 } | |
166 | |
167 void ExtensionProcessManager::EnsureBrowserWhenRequired( | 151 void ExtensionProcessManager::EnsureBrowserWhenRequired( |
168 Browser* browser, | 152 Browser* browser, |
169 content::ViewType view_type) { | 153 content::ViewType view_type) { |
170 if (!browser) { | 154 if (!browser) { |
171 #if defined (OS_CHROMEOS) | 155 #if defined (OS_CHROMEOS) |
172 // On ChromeOS we'll only use ExtensionView, which | 156 // On ChromeOS we'll only use ExtensionView, which |
173 // does not use the browser parameter. | 157 // does not use the browser parameter. |
174 // TODO(rkc): Remove all this once we create a new host for | 158 // TODO(rkc): Remove all this once we create a new host for |
175 // screensaver extensions (crosbug.com/28211). | 159 // screensaver extensions (crosbug.com/28211). |
176 DCHECK(view_type == chrome::VIEW_TYPE_EXTENSION_POPUP || | 160 DCHECK(view_type == chrome::VIEW_TYPE_EXTENSION_POPUP || |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 if (service && service->is_ready()) | 669 if (service && service->is_ready()) |
686 CreateBackgroundHostsForProfileStartup(this, service->extensions()); | 670 CreateBackgroundHostsForProfileStartup(this, service->extensions()); |
687 } | 671 } |
688 break; | 672 break; |
689 } | 673 } |
690 default: | 674 default: |
691 ExtensionProcessManager::Observe(type, source, details); | 675 ExtensionProcessManager::Observe(type, source, details); |
692 break; | 676 break; |
693 } | 677 } |
694 } | 678 } |
OLD | NEW |