Index: chrome/browser/extensions/extension_process_manager.h |
diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h |
index c5a936ac6226646f41f2c2db4a5a46c03f732d71..57499f4d3c86ff0a08957744b53efb4a998dfd24 100644 |
--- a/chrome/browser/extensions/extension_process_manager.h |
+++ b/chrome/browser/extensions/extension_process_manager.h |
@@ -25,6 +25,7 @@ class Profile; |
namespace content { |
class RenderViewHost; |
class SiteInstance; |
+class WebContents; |
}; |
// Manages dynamic state of running Chromium extensions. There is one instance |
@@ -32,9 +33,23 @@ class SiteInstance; |
// track of split-mode extensions only. |
class ExtensionProcessManager : public content::NotificationObserver { |
public: |
+ typedef std::set<ExtensionHost*> ExtensionHostSet; |
+ typedef ExtensionHostSet::const_iterator const_iterator; |
+ |
static ExtensionProcessManager* Create(Profile* profile); |
virtual ~ExtensionProcessManager(); |
+ const ExtensionHostSet& background_hosts() const { |
+ return background_hosts_; |
+ } |
+ |
+ const ExtensionHostSet& platform_app_hosts() const { |
+ return platform_app_hosts_; |
+ } |
+ |
+ typedef std::set<content::WebContents*> ContentsSet; |
+ const ContentsSet GetAllContents() const; |
+ |
// Creates a new ExtensionHost with its associated view, grouping it in the |
// appropriate SiteInstance (and therefore process) based on the URL and |
// profile. |
@@ -74,20 +89,22 @@ class ExtensionProcessManager : public content::NotificationObserver { |
// apps, not hosted apps. |
virtual content::SiteInstance* GetSiteInstanceForURL(const GURL& url); |
- // Registers a RenderViewHost as hosting a given extension. |
- void RegisterRenderViewHost(content::RenderViewHost* render_view_host, |
- const Extension* extension); |
+ // Registers a WebContents as hosting a given extension. |
+ void RegisterWebContents(content::WebContents* web_contents, |
+ const Extension* extension); |
- // Unregisters a RenderViewHost as hosting any extension. |
- void UnregisterRenderViewHost(content::RenderViewHost* render_view_host); |
+ // Unregisters a WebContents as hosting any extension. |
+ void UnregisterWebContents(content::WebContents* web_contents); |
// Returns all RenderViewHosts that are registered for the specified |
// extension. |
std::set<content::RenderViewHost*> GetRenderViewHostsForExtension( |
const std::string& extension_id); |
- // Returns true if |host| is managed by this process manager. |
- bool HasExtensionHost(ExtensionHost* host) const; |
+ // Returns the extension associated with the specified RenderViewHost, or |
+ // NULL. |
+ const Extension* GetExtensionForRenderViewHost( |
+ content::RenderViewHost* render_view_host); |
// Getter and setter for the lazy background page's keepalive count. This is |
// the count of how many outstanding "things" are keeping the page alive. |
@@ -109,11 +126,6 @@ class ExtensionProcessManager : public content::NotificationObserver { |
void OnNetworkRequestStarted(content::RenderViewHost* render_view_host); |
void OnNetworkRequestDone(content::RenderViewHost* render_view_host); |
- typedef std::set<ExtensionHost*> ExtensionHostSet; |
- typedef ExtensionHostSet::const_iterator const_iterator; |
- const_iterator begin() const { return all_hosts_.begin(); } |
- const_iterator end() const { return all_hosts_.end(); } |
- |
protected: |
explicit ExtensionProcessManager(Profile* profile); |
@@ -134,12 +146,12 @@ class ExtensionProcessManager : public content::NotificationObserver { |
content::NotificationRegistrar registrar_; |
- // The set of all ExtensionHosts managed by this process manager. |
- ExtensionHostSet all_hosts_; |
- |
- // The set of running viewless background extensions. |
+ // The set of ExtensionHosts running viewless background extensions. |
ExtensionHostSet background_hosts_; |
+ // The set of ExtensionHosts running platform apps. |
+ ExtensionHostSet platform_app_hosts_; |
+ |
// A SiteInstance related to the SiteInstance for all extensions in |
// this profile. We create it in such a way that a new |
// browsing instance is created. This controls process grouping. |
@@ -151,12 +163,12 @@ class ExtensionProcessManager : public content::NotificationObserver { |
typedef std::string ExtensionId; |
typedef std::map<ExtensionId, BackgroundPageData> BackgroundPageDataMap; |
- // Contains all extension-related RenderViewHost instances for all extensions. |
+ // Contains all extension-related WebContents instances for all extensions. |
// We also keep a cache of the host's view type, because that information |
// is not accessible at registration/deregistration time. |
- typedef std::map<content::RenderViewHost*, |
- content::ViewType> ExtensionRenderViews; |
- ExtensionRenderViews all_extension_views_; |
+ typedef std::map<content::WebContents*, |
+ content::ViewType> ExtensionWebContents; |
+ ExtensionWebContents all_extension_contents_; |
// Close the given |host| iff it's a background page. |
void CloseBackgroundHost(ExtensionHost* host); |
@@ -170,10 +182,10 @@ class ExtensionProcessManager : public content::NotificationObserver { |
void OnLazyBackgroundPageIdle(const std::string& extension_id); |
void OnLazyBackgroundPageActive(const std::string& extension_id); |
- // Updates a potentially-registered RenderViewHost once it has been |
+ // Updates a potentially-registered WebContents once it has been |
// associated with a WebContents. This allows us to gather information that |
// was not available when the host was first registered. |
- void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); |
+ void UpdateRegisteredWebContents(content::WebContents* web_contents); |
BackgroundPageDataMap background_page_data_; |