| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 const extensions::Extension* extension); | 94 const extensions::Extension* extension); |
| 95 | 95 |
| 96 // Unregisters a RenderViewHost as hosting any extension. | 96 // Unregisters a RenderViewHost as hosting any extension. |
| 97 void UnregisterRenderViewHost(content::RenderViewHost* render_view_host); | 97 void UnregisterRenderViewHost(content::RenderViewHost* render_view_host); |
| 98 | 98 |
| 99 // Returns all RenderViewHosts that are registered for the specified | 99 // Returns all RenderViewHosts that are registered for the specified |
| 100 // extension. | 100 // extension. |
| 101 std::set<content::RenderViewHost*> GetRenderViewHostsForExtension( | 101 std::set<content::RenderViewHost*> GetRenderViewHostsForExtension( |
| 102 const std::string& extension_id); | 102 const std::string& extension_id); |
| 103 | 103 |
| 104 // Returns all RenderViewHosts that are registered for the specified |
| 105 // extension and have the given view type. |
| 106 std::set<content::RenderViewHost*> GetRenderViewHostsWithTypeForExtension( |
| 107 const std::string& extension_id, chrome::ViewType view_type); |
| 108 |
| 104 // Returns the extension associated with the specified RenderViewHost, or | 109 // Returns the extension associated with the specified RenderViewHost, or |
| 105 // NULL. | 110 // NULL. |
| 106 const extensions::Extension* GetExtensionForRenderViewHost( | 111 const extensions::Extension* GetExtensionForRenderViewHost( |
| 107 content::RenderViewHost* render_view_host); | 112 content::RenderViewHost* render_view_host); |
| 108 | 113 |
| 109 // Returns true if the (lazy) background host for the given extension has | 114 // Returns true if the (lazy) background host for the given extension has |
| 110 // already been sent the unload event and is shutting down. | 115 // already been sent the unload event and is shutting down. |
| 111 bool IsBackgroundHostClosing(const std::string& extension_id); | 116 bool IsBackgroundHostClosing(const std::string& extension_id); |
| 112 | 117 |
| 113 // Getter and setter for the lazy background page's keepalive count. This is | 118 // Getter and setter for the lazy background page's keepalive count. This is |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 void CloseLazyBackgroundPageNow(const std::string& extension_id); | 194 void CloseLazyBackgroundPageNow(const std::string& extension_id); |
| 190 | 195 |
| 191 // Updates a potentially-registered RenderViewHost once it has been | 196 // Updates a potentially-registered RenderViewHost once it has been |
| 192 // associated with a WebContents. This allows us to gather information that | 197 // associated with a WebContents. This allows us to gather information that |
| 193 // was not available when the host was first registered. | 198 // was not available when the host was first registered. |
| 194 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); | 199 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); |
| 195 | 200 |
| 196 // Clears background page data for this extension. | 201 // Clears background page data for this extension. |
| 197 void ClearBackgroundPageData(const std::string& extension_id); | 202 void ClearBackgroundPageData(const std::string& extension_id); |
| 198 | 203 |
| 204 // Gets the RVHs for the given extension. If |restrict_to_type| is true, only |
| 205 // views of |view_type| are returned. |
| 206 std::set<content::RenderViewHost*> DoGetRenderViewHostsForExtension( |
| 207 const std::string& extension_id, |
| 208 bool restrict_to_type, |
| 209 chrome::ViewType view_type); |
| 210 |
| 199 BackgroundPageDataMap background_page_data_; | 211 BackgroundPageDataMap background_page_data_; |
| 200 | 212 |
| 201 // The time to delay between an extension becoming idle and | 213 // The time to delay between an extension becoming idle and |
| 202 // sending a ShouldUnload message; read from command-line switch. | 214 // sending a ShouldUnload message; read from command-line switch. |
| 203 base::TimeDelta event_page_idle_time_; | 215 base::TimeDelta event_page_idle_time_; |
| 204 | 216 |
| 205 // The time to delay between sending a ShouldUnload message and | 217 // The time to delay between sending a ShouldUnload message and |
| 206 // sending a Unload message; read from command-line switch. | 218 // sending a Unload message; read from command-line switch. |
| 207 base::TimeDelta event_page_unloading_time_; | 219 base::TimeDelta event_page_unloading_time_; |
| 208 | 220 |
| 209 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; | 221 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; |
| 210 | 222 |
| 211 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 223 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
| 212 }; | 224 }; |
| 213 | 225 |
| 214 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 226 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
| OLD | NEW |