| 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 typedef std::set<ExtensionHost*> ExtensionHostSet; | 35 typedef std::set<ExtensionHost*> ExtensionHostSet; |
| 36 typedef ExtensionHostSet::const_iterator const_iterator; | 36 typedef ExtensionHostSet::const_iterator const_iterator; |
| 37 | 37 |
| 38 static ExtensionProcessManager* Create(Profile* profile); | 38 static ExtensionProcessManager* Create(Profile* profile); |
| 39 virtual ~ExtensionProcessManager(); | 39 virtual ~ExtensionProcessManager(); |
| 40 | 40 |
| 41 const ExtensionHostSet& background_hosts() const { | 41 const ExtensionHostSet& background_hosts() const { |
| 42 return background_hosts_; | 42 return background_hosts_; |
| 43 } | 43 } |
| 44 | 44 |
| 45 const ExtensionHostSet& platform_app_hosts() const { | |
| 46 return platform_app_hosts_; | |
| 47 } | |
| 48 | |
| 49 typedef std::set<content::RenderViewHost*> ViewSet; | 45 typedef std::set<content::RenderViewHost*> ViewSet; |
| 50 const ViewSet GetAllViews() const; | 46 const ViewSet GetAllViews() const; |
| 51 | 47 |
| 52 // Creates a new ExtensionHost with its associated view, grouping it in the | 48 // Creates a new ExtensionHost with its associated view, grouping it in the |
| 53 // appropriate SiteInstance (and therefore process) based on the URL and | 49 // appropriate SiteInstance (and therefore process) based on the URL and |
| 54 // profile. | 50 // profile. |
| 55 virtual ExtensionHost* CreateViewHost(const Extension* extension, | 51 virtual ExtensionHost* CreateViewHost(const Extension* extension, |
| 56 const GURL& url, | 52 const GURL& url, |
| 57 Browser* browser, | 53 Browser* browser, |
| 58 content::ViewType view_type); | 54 content::ViewType view_type); |
| 59 ExtensionHost* CreateViewHost(const GURL& url, | 55 ExtensionHost* CreateViewHost(const GURL& url, |
| 60 Browser* browser, | 56 Browser* browser, |
| 61 content::ViewType view_type); | 57 content::ViewType view_type); |
| 62 ExtensionHost* CreatePopupHost(const Extension* extension, | 58 ExtensionHost* CreatePopupHost(const Extension* extension, |
| 63 const GURL& url, | 59 const GURL& url, |
| 64 Browser* browser); | 60 Browser* browser); |
| 65 ExtensionHost* CreatePopupHost(const GURL& url, Browser* browser); | 61 ExtensionHost* CreatePopupHost(const GURL& url, Browser* browser); |
| 66 ExtensionHost* CreateDialogHost(const GURL& url, Browser* browser); | 62 ExtensionHost* CreateDialogHost(const GURL& url, Browser* browser); |
| 67 ExtensionHost* CreateInfobarHost(const Extension* extension, | 63 ExtensionHost* CreateInfobarHost(const Extension* extension, |
| 68 const GURL& url, | 64 const GURL& url, |
| 69 Browser* browser); | 65 Browser* browser); |
| 70 ExtensionHost* CreateInfobarHost(const GURL& url, | 66 ExtensionHost* CreateInfobarHost(const GURL& url, |
| 71 Browser* browser); | 67 Browser* browser); |
| 72 ExtensionHost* CreateShellHost(const Extension* extension, const GURL& url); | |
| 73 | 68 |
| 74 // Open the extension's options page. | 69 // Open the extension's options page. |
| 75 void OpenOptionsPage(const Extension* extension, Browser* browser); | 70 void OpenOptionsPage(const Extension* extension, Browser* browser); |
| 76 | 71 |
| 77 // Creates a new UI-less extension instance. Like CreateViewHost, but not | 72 // Creates a new UI-less extension instance. Like CreateViewHost, but not |
| 78 // displayed anywhere. | 73 // displayed anywhere. |
| 79 virtual void CreateBackgroundHost(const Extension* extension, | 74 virtual void CreateBackgroundHost(const Extension* extension, |
| 80 const GURL& url); | 75 const GURL& url); |
| 81 | 76 |
| 82 // Gets the ExtensionHost for the background page for an extension, or NULL if | 77 // Gets the ExtensionHost for the background page for an extension, or NULL if |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 140 |
| 146 // Gets the profile associated with site_instance_ and all other | 141 // Gets the profile associated with site_instance_ and all other |
| 147 // related SiteInstances. | 142 // related SiteInstances. |
| 148 Profile* GetProfile() const; | 143 Profile* GetProfile() const; |
| 149 | 144 |
| 150 content::NotificationRegistrar registrar_; | 145 content::NotificationRegistrar registrar_; |
| 151 | 146 |
| 152 // The set of ExtensionHosts running viewless background extensions. | 147 // The set of ExtensionHosts running viewless background extensions. |
| 153 ExtensionHostSet background_hosts_; | 148 ExtensionHostSet background_hosts_; |
| 154 | 149 |
| 155 // The set of ExtensionHosts running platform apps. | |
| 156 ExtensionHostSet platform_app_hosts_; | |
| 157 | |
| 158 // A SiteInstance related to the SiteInstance for all extensions in | 150 // A SiteInstance related to the SiteInstance for all extensions in |
| 159 // this profile. We create it in such a way that a new | 151 // this profile. We create it in such a way that a new |
| 160 // browsing instance is created. This controls process grouping. | 152 // browsing instance is created. This controls process grouping. |
| 161 scoped_refptr<content::SiteInstance> site_instance_; | 153 scoped_refptr<content::SiteInstance> site_instance_; |
| 162 | 154 |
| 163 private: | 155 private: |
| 164 // Extra information we keep for each extension's background page. | 156 // Extra information we keep for each extension's background page. |
| 165 struct BackgroundPageData; | 157 struct BackgroundPageData; |
| 166 typedef std::string ExtensionId; | 158 typedef std::string ExtensionId; |
| 167 typedef std::map<ExtensionId, BackgroundPageData> BackgroundPageDataMap; | 159 typedef std::map<ExtensionId, BackgroundPageData> BackgroundPageDataMap; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 189 // associated with a WebContents. This allows us to gather information that | 181 // associated with a WebContents. This allows us to gather information that |
| 190 // was not available when the host was first registered. | 182 // was not available when the host was first registered. |
| 191 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); | 183 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); |
| 192 | 184 |
| 193 BackgroundPageDataMap background_page_data_; | 185 BackgroundPageDataMap background_page_data_; |
| 194 | 186 |
| 195 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 187 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
| 196 }; | 188 }; |
| 197 | 189 |
| 198 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 190 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
| OLD | NEW |