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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 virtual SiteInstance* GetSiteInstanceForURL(const GURL& url); | 70 virtual SiteInstance* GetSiteInstanceForURL(const GURL& url); |
71 | 71 |
72 // Registers a SiteInstance with |site_instance_id| as hosting the extension | 72 // Registers a SiteInstance with |site_instance_id| as hosting the extension |
73 // with |extension_id|. | 73 // with |extension_id|. |
74 void RegisterExtensionSiteInstance(int site_instance_id, | 74 void RegisterExtensionSiteInstance(int site_instance_id, |
75 const std::string& extension_id); | 75 const std::string& extension_id); |
76 | 76 |
77 // Unregisters the extension associated with |site_instance_id|. | 77 // Unregisters the extension associated with |site_instance_id|. |
78 void UnregisterExtensionSiteInstance(int site_instance_id); | 78 void UnregisterExtensionSiteInstance(int site_instance_id); |
79 | 79 |
80 // Registers a RenderProcessHost with |host_id| as having permission to | |
81 // access extension bindings. | |
82 void RegisterProcessHostWithBindings(int host_id); | |
Aaron Boodman
2011/09/27 19:26:49
Can we just call these methods "RegisterProcess",
jochen (gone - plz use gerrit)
2011/09/27 20:41:40
Done
| |
83 | |
84 // Unregisters the RenderProcessHost with |host_id|. | |
85 void UnregisterProcessHostWithBindings(int host_id); | |
86 | |
87 // True if this process host is known to have access to extension bindings. | |
88 bool IsProcessHostWithBindings(int host_id) const; | |
89 | |
80 // Returns the extension process that |url| is associated with if it exists. | 90 // Returns the extension process that |url| is associated with if it exists. |
81 // This is not valid for hosted apps without the background permission, since | 91 // This is not valid for hosted apps without the background permission, since |
82 // such apps may have multiple processes. | 92 // such apps may have multiple processes. |
83 virtual RenderProcessHost* GetExtensionProcess(const GURL& url); | 93 virtual RenderProcessHost* GetExtensionProcess(const GURL& url); |
84 | 94 |
85 // Returns the process that the extension with the given ID is running in. | 95 // Returns the process that the extension with the given ID is running in. |
86 RenderProcessHost* GetExtensionProcess(const std::string& extension_id); | 96 RenderProcessHost* GetExtensionProcess(const std::string& extension_id); |
87 | 97 |
88 // Returns the Extension associated with the given SiteInstance id, if any. | 98 // Returns the Extension associated with the given SiteInstance id, if any. |
89 virtual const Extension* GetExtensionForSiteInstance(int site_instance_id); | 99 virtual const Extension* GetExtensionForSiteInstance(int site_instance_id); |
(...skipping 29 matching lines...) Expand all Loading... | |
119 ExtensionHostSet background_hosts_; | 129 ExtensionHostSet background_hosts_; |
120 | 130 |
121 // The BrowsingInstance shared by all extensions in this profile. This | 131 // The BrowsingInstance shared by all extensions in this profile. This |
122 // controls process grouping. | 132 // controls process grouping. |
123 scoped_refptr<BrowsingInstance> browsing_instance_; | 133 scoped_refptr<BrowsingInstance> browsing_instance_; |
124 | 134 |
125 // A map of site instance ID to the ID of the extension it hosts. | 135 // A map of site instance ID to the ID of the extension it hosts. |
126 typedef std::map<int, std::string> SiteInstanceIDMap; | 136 typedef std::map<int, std::string> SiteInstanceIDMap; |
127 SiteInstanceIDMap extension_ids_; | 137 SiteInstanceIDMap extension_ids_; |
128 | 138 |
139 // A set of render process host IDs that have access to extension bindings. | |
140 std::set<int> process_ids_; | |
141 | |
129 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 142 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
130 }; | 143 }; |
131 | 144 |
132 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 145 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |