Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Unified Diff: chrome/browser/extensions/extension_process_manager.h

Issue 3210007: Add support for a "split" incognito behavior for extensions. (Closed)
Patch Set: latest Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 5f718066f0445f35b620a1ca95cca66652b9f21f..5b2ade74882ce9edadb1aca7bb7ce7366c7dd649 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);
@@ -50,20 +51,20 @@ class ExtensionProcessManager : public NotificationObserver {
Browser* browser);
ExtensionHost* CreateInfobar(const GURL& url,
Browser* browser);
+
+ // 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.
- ExtensionHost* CreateBackgroundHost(Extension* extension, const GURL& url);
-
- // Open the extension's options page.
- void OpenOptionsPage(Extension* extension, Browser* browser);
+ 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.
« no previous file with comments | « chrome/browser/extensions/extension_popup_api.cc ('k') | chrome/browser/extensions/extension_process_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698