OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 virtual void CreateBackgroundHost(const Extension* extension, | 61 virtual void CreateBackgroundHost(const Extension* extension, |
62 const GURL& url); | 62 const GURL& url); |
63 | 63 |
64 // Gets the ExtensionHost for the background page for an extension, or NULL if | 64 // Gets the ExtensionHost for the background page for an extension, or NULL if |
65 // the extension isn't running or doesn't have a background page. | 65 // the extension isn't running or doesn't have a background page. |
66 ExtensionHost* GetBackgroundHostForExtension(const Extension* extension); | 66 ExtensionHost* GetBackgroundHostForExtension(const Extension* extension); |
67 | 67 |
68 // Returns the SiteInstance that the given URL belongs to. | 68 // Returns the SiteInstance that the given URL belongs to. |
69 virtual SiteInstance* GetSiteInstanceForURL(const GURL& url); | 69 virtual SiteInstance* GetSiteInstanceForURL(const GURL& url); |
70 | 70 |
71 // Registers an extension process by |extension_id| and specifying which | |
72 // |process_id| it belongs to. | |
73 void RegisterExtensionProcess(const std::string& extension_id, | |
74 int process_id); | |
75 | |
76 // Unregisters an extension process with specified |process_id|. | |
77 void UnregisterExtensionProcess(int process_id); | |
78 | |
79 // Returns the extension process that |url| is associated with if it exists. | 71 // Returns the extension process that |url| is associated with if it exists. |
80 virtual RenderProcessHost* GetExtensionProcess(const GURL& url); | 72 virtual RenderProcessHost* GetExtensionProcess(const GURL& url); |
81 | 73 |
82 // Returns the process that the extension with the given ID is running in. | 74 // Returns the process that the extension with the given ID is running in. |
83 RenderProcessHost* GetExtensionProcess(const std::string& extension_id); | 75 RenderProcessHost* GetExtensionProcess(const std::string& extension_id); |
84 | 76 |
85 // Returns true if |host| is managed by this process manager. | 77 // Returns true if |host| is managed by this process manager. |
86 bool HasExtensionHost(ExtensionHost* host) const; | 78 bool HasExtensionHost(ExtensionHost* host) const; |
87 | 79 |
88 typedef std::set<ExtensionHost*> ExtensionHostSet; | 80 typedef std::set<ExtensionHost*> ExtensionHostSet; |
(...skipping 20 matching lines...) Expand all Loading... |
109 // The set of all ExtensionHosts managed by this process manager. | 101 // The set of all ExtensionHosts managed by this process manager. |
110 ExtensionHostSet all_hosts_; | 102 ExtensionHostSet all_hosts_; |
111 | 103 |
112 // The set of running viewless background extensions. | 104 // The set of running viewless background extensions. |
113 ExtensionHostSet background_hosts_; | 105 ExtensionHostSet background_hosts_; |
114 | 106 |
115 // The BrowsingInstance shared by all extensions in this profile. This | 107 // The BrowsingInstance shared by all extensions in this profile. This |
116 // controls process grouping. | 108 // controls process grouping. |
117 scoped_refptr<BrowsingInstance> browsing_instance_; | 109 scoped_refptr<BrowsingInstance> browsing_instance_; |
118 | 110 |
119 // A map of extension ID to the render_process_id that the extension lives in. | |
120 typedef std::map<std::string, int> ProcessIDMap; | |
121 ProcessIDMap process_ids_; | |
122 | |
123 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 111 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
124 }; | 112 }; |
125 | 113 |
126 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 114 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |