summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_process_manager.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/extensions/extension_process_manager.h')
-rwxr-xr-xchrome/browser/extensions/extension_process_manager.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_process_manager.h b/chrome/browser/extensions/extension_process_manager.h
new file mode 100755
index 0000000..0d4048b
--- /dev/null
+++ b/chrome/browser/extensions/extension_process_manager.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_
+
+#include "base/ref_counted.h"
+
+#include <map>
+
+class BrowsingInstance;
+class Extension;
+class ExtensionView;
+class GURL;
+class Profile;
+class SiteInstance;
+
+// This class controls what process new extension instances use. We use the
+// BrowsingInstance site grouping rules to group extensions. Since all
+// resources in a given extension have the same origin, they will be grouped
+// into the same process.
+//
+// We separate further by Profile: each Profile has its own group of extension
+// processes that never overlap with other Profiles.
+class ExtensionProcessManager {
+ public:
+ static ExtensionProcessManager* GetInstance();
+
+ // These are public for use by Singleton. Do not instantiate or delete
+ // manually.
+ ExtensionProcessManager();
+ ~ExtensionProcessManager();
+
+ // Creates a new ExtensionView, grouping it in the appropriate SiteInstance
+ // (and therefore process) based on the URL and profile.
+ ExtensionView* CreateView(Extension* extension,
+ const GURL& url,
+ Profile* profile);
+
+ // Returns the SiteInstance that the given URL belongs to in this profile.
+ SiteInstance* GetSiteInstanceForURL(const GURL& url, Profile* profile);
+ private:
+ // Returns our BrowsingInstance for the given profile. Lazily created and
+ // cached.
+ BrowsingInstance* GetBrowsingInstance(Profile* profile);
+
+ // Cache of BrowsingInstances grouped by Profile.
+ typedef std::map<Profile*, scoped_refptr<BrowsingInstance> >
+ BrowsingInstanceMap;
+ BrowsingInstanceMap browsing_instance_map_;
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_