OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/extensions/extension_process_manager.h" | 7 #include "chrome/browser/extensions/extension_process_manager.h" |
8 | 8 |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "content/browser/browsing_instance.h" | 10 #include "content/browser/browsing_instance.h" |
11 #include "chrome/browser/extensions/extension_event_router.h" | 11 #include "chrome/browser/extensions/extension_event_router.h" |
12 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) |
13 #include "chrome/browser/extensions/extension_host_mac.h" | 13 #include "chrome/browser/extensions/extension_host_mac.h" |
14 #endif | 14 #endif |
15 #include "chrome/browser/extensions/extension_host.h" | 15 #include "chrome/browser/extensions/extension_host.h" |
16 #include "chrome/browser/extensions/extension_info_map.h" | 16 #include "chrome/browser/extensions/extension_info_map.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/ui/browser.h" | 19 #include "chrome/browser/ui/browser.h" |
20 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/chrome_view_type.h" | 22 #include "chrome/common/chrome_view_type.h" |
23 #include "chrome/common/extensions/extension.h" | 23 #include "chrome/common/extensions/extension.h" |
24 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
25 #include "content/browser/renderer_host/render_view_host.h" | 25 #include "content/browser/renderer_host/render_view_host.h" |
| 26 #include "content/browser/renderer_host/render_view_host_delegate.h" |
26 #include "content/browser/site_instance.h" | 27 #include "content/browser/site_instance.h" |
27 #include "content/browser/tab_contents/tab_contents.h" | |
28 #include "content/public/browser/browser_thread.h" | 28 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
| 30 #include "content/public/browser/web_contents.h" |
30 | 31 |
31 using content::BrowserThread; | 32 using content::BrowserThread; |
32 using content::OpenURLParams; | 33 using content::OpenURLParams; |
33 using content::Referrer; | 34 using content::Referrer; |
34 | 35 |
35 namespace { | 36 namespace { |
36 | 37 |
37 // Incognito profiles use this process manager. It is mostly a shim that decides | 38 // Incognito profiles use this process manager. It is mostly a shim that decides |
38 // whether to fall back on the original profile's ExtensionProcessManager based | 39 // whether to fall back on the original profile's ExtensionProcessManager based |
39 // on whether a given extension uses "split" or "spanning" incognito behavior. | 40 // on whether a given extension uses "split" or "spanning" incognito behavior. |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 if (!browser || browser->profile()->IsOffTheRecord()) { | 213 if (!browser || browser->profile()->IsOffTheRecord()) { |
213 Profile* profile = | 214 Profile* profile = |
214 Profile::FromBrowserContext(browsing_instance_->browser_context()); | 215 Profile::FromBrowserContext(browsing_instance_->browser_context()); |
215 browser = Browser::GetOrCreateTabbedBrowser(profile->GetOriginalProfile()); | 216 browser = Browser::GetOrCreateTabbedBrowser(profile->GetOriginalProfile()); |
216 } | 217 } |
217 | 218 |
218 OpenURLParams params(extension->options_url(), Referrer(), SINGLETON_TAB, | 219 OpenURLParams params(extension->options_url(), Referrer(), SINGLETON_TAB, |
219 content::PAGE_TRANSITION_LINK, false); | 220 content::PAGE_TRANSITION_LINK, false); |
220 browser->OpenURL(params); | 221 browser->OpenURL(params); |
221 browser->window()->Show(); | 222 browser->window()->Show(); |
222 static_cast<RenderViewHostDelegate*>(browser->GetSelectedTabContents())-> | 223 browser->GetSelectedWebContents()->GetRenderViewHost()->delegate()-> |
223 Activate(); | 224 Activate(); |
224 } | 225 } |
225 | 226 |
226 ExtensionHost* ExtensionProcessManager::GetBackgroundHostForExtension( | 227 ExtensionHost* ExtensionProcessManager::GetBackgroundHostForExtension( |
227 const std::string& extension_id) { | 228 const std::string& extension_id) { |
228 for (ExtensionHostSet::iterator iter = background_hosts_.begin(); | 229 for (ExtensionHostSet::iterator iter = background_hosts_.begin(); |
229 iter != background_hosts_.end(); ++iter) { | 230 iter != background_hosts_.end(); ++iter) { |
230 ExtensionHost* host = *iter; | 231 ExtensionHost* host = *iter; |
231 if (host->extension_id() == extension_id) | 232 if (host->extension_id() == extension_id) |
232 return host; | 233 return host; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 if (service && service->is_ready()) | 484 if (service && service->is_ready()) |
484 CreateBackgroundHostsForProfileStartup(this, service->extensions()); | 485 CreateBackgroundHostsForProfileStartup(this, service->extensions()); |
485 } | 486 } |
486 break; | 487 break; |
487 } | 488 } |
488 default: | 489 default: |
489 ExtensionProcessManager::Observe(type, source, details); | 490 ExtensionProcessManager::Observe(type, source, details); |
490 break; | 491 break; |
491 } | 492 } |
492 } | 493 } |
OLD | NEW |