diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 18:40:32 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-31 18:40:32 +0000 |
commit | bc535ee5bb4eece29f5d88bcc688613b3b208b27 (patch) | |
tree | 37b90c6bbbe98732c81515b35f02f8b835ac5df7 /chrome/browser/extensions/extension_process_manager.h | |
parent | 7566dbf757617f9e77f4a7f9f031402eb7818b04 (diff) | |
download | chromium_src-bc535ee5bb4eece29f5d88bcc688613b3b208b27.zip chromium_src-bc535ee5bb4eece29f5d88bcc688613b3b208b27.tar.gz chromium_src-bc535ee5bb4eece29f5d88bcc688613b3b208b27.tar.bz2 |
Add support for a "split" incognito behavior for extensions.
- On by default for apps, off by default for extensions.
- Split mode means "run incognito extensions in a separate process if the user
says OK, and the two processes can only see their own profile."
- Spanning mode is what we have now, and means "run a single extension process,
but allow it to access both profiles if the user says OK."
BUG=49232
BUG=49114
TEST=extensions still work in incognito when you check "Allow in Incognito".
Review URL: http://codereview.chromium.org/3210007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58033 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_process_manager.h')
-rw-r--r-- | chrome/browser/extensions/extension_process_manager.h | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h index 5f71806..d284275 100644 --- a/chrome/browser/extensions/extension_process_manager.h +++ b/chrome/browser/extensions/extension_process_manager.h @@ -24,17 +24,18 @@ class Profile; class RenderProcessHost; class SiteInstance; -// Manages dynamic state of running Chromium extensions. There is one instance -// of this class per Profile (including OTR). +// Manages dynamic state of running Chromium extensions. There is one instance +// of this class per Profile. OTR Profiles have a separate instance that keeps +// track of split-mode extensions only. class ExtensionProcessManager : public NotificationObserver { public: - explicit ExtensionProcessManager(Profile* profile); - ~ExtensionProcessManager(); + static ExtensionProcessManager* Create(Profile* profile); + virtual ~ExtensionProcessManager(); // Creates a new ExtensionHost with its associated view, grouping it in the // appropriate SiteInstance (and therefore process) based on the URL and // profile. - ExtensionHost* CreateView(Extension* extension, + virtual ExtensionHost* CreateView(Extension* extension, const GURL& url, Browser* browser, ViewType::Type view_type); @@ -51,19 +52,19 @@ class ExtensionProcessManager : public NotificationObserver { ExtensionHost* CreateInfobar(const GURL& url, Browser* browser); - // Creates a new UI-less extension instance. Like CreateView, but not - // displayed anywhere. - ExtensionHost* CreateBackgroundHost(Extension* extension, const GURL& url); - // Open the extension's options page. void OpenOptionsPage(Extension* extension, Browser* browser); + // Creates a new UI-less extension instance. Like CreateView, but not + // displayed anywhere. + virtual void CreateBackgroundHost(Extension* extension, const GURL& url); + // Gets the ExtensionHost for the background page for an extension, or NULL if // the extension isn't running or doesn't have a background page. ExtensionHost* GetBackgroundHostForExtension(Extension* extension); // Returns the SiteInstance that the given URL belongs to. - SiteInstance* GetSiteInstanceForURL(const GURL& url); + virtual SiteInstance* GetSiteInstanceForURL(const GURL& url); // Registers an extension process by |extension_id| and specifying which // |process_id| it belongs to. @@ -74,33 +75,33 @@ class ExtensionProcessManager : public NotificationObserver { void UnregisterExtensionProcess(int process_id); // Returns the extension process that |url| is associated with if it exists. - RenderProcessHost* GetExtensionProcess(const GURL& url); + virtual RenderProcessHost* GetExtensionProcess(const GURL& url); // Returns the process that the extension with the given ID is running in. - // NOTE: This does not currently handle app processes with no - // ExtensionFunctionDispatcher objects. RenderProcessHost* GetExtensionProcess(const std::string& extension_id); // Returns true if |host| is managed by this process manager. bool HasExtensionHost(ExtensionHost* host) const; - // NotificationObserver: - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details); - 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(); } - private: + protected: + explicit ExtensionProcessManager(Profile* profile); + // Called just after |host| is created so it can be registered in our lists. void OnExtensionHostCreated(ExtensionHost* host, bool is_background); // Called on browser shutdown to close our extension hosts. void CloseBackgroundHosts(); + // NotificationObserver: + virtual void Observe(NotificationType type, + const NotificationSource& source, + const NotificationDetails& details); + NotificationRegistrar registrar_; // The set of all ExtensionHosts managed by this process manager. |