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 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void OnShouldUnloadAck(const std::string& extension_id, int sequence_id); | 125 void OnShouldUnloadAck(const std::string& extension_id, int sequence_id); |
126 | 126 |
127 // Same as above, for the Unload message. | 127 // Same as above, for the Unload message. |
128 void OnUnloadAck(const std::string& extension_id); | 128 void OnUnloadAck(const std::string& extension_id); |
129 | 129 |
130 // Tracks network requests for a given RenderViewHost, used to know | 130 // Tracks network requests for a given RenderViewHost, used to know |
131 // when network activity is idle for lazy background pages. | 131 // when network activity is idle for lazy background pages. |
132 void OnNetworkRequestStarted(content::RenderViewHost* render_view_host); | 132 void OnNetworkRequestStarted(content::RenderViewHost* render_view_host); |
133 void OnNetworkRequestDone(content::RenderViewHost* render_view_host); | 133 void OnNetworkRequestDone(content::RenderViewHost* render_view_host); |
134 | 134 |
| 135 // Prevents |extension|'s background page from being closed and sends the |
| 136 // onSuspendCanceled() event to it. |
| 137 void CancelSuspend(const extensions::Extension* extension); |
| 138 |
135 protected: | 139 protected: |
136 explicit ExtensionProcessManager(Profile* profile); | 140 explicit ExtensionProcessManager(Profile* profile); |
137 | 141 |
138 // Called just after |host| is created so it can be registered in our lists. | 142 // Called just after |host| is created so it can be registered in our lists. |
139 void OnExtensionHostCreated(ExtensionHost* host, bool is_background); | 143 void OnExtensionHostCreated(ExtensionHost* host, bool is_background); |
140 | 144 |
141 // Called on browser shutdown to close our extension hosts. | 145 // Called on browser shutdown to close our extension hosts. |
142 void CloseBackgroundHosts(); | 146 void CloseBackgroundHosts(); |
143 | 147 |
144 // content::NotificationObserver: | 148 // content::NotificationObserver: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 182 |
179 // Ensure browser object is not null except for certain situations. | 183 // Ensure browser object is not null except for certain situations. |
180 void EnsureBrowserWhenRequired(Browser* browser, | 184 void EnsureBrowserWhenRequired(Browser* browser, |
181 chrome::ViewType view_type); | 185 chrome::ViewType view_type); |
182 | 186 |
183 // These are called when the extension transitions between idle and active. | 187 // These are called when the extension transitions between idle and active. |
184 // They control the process of closing the background page when idle. | 188 // They control the process of closing the background page when idle. |
185 void OnLazyBackgroundPageIdle(const std::string& extension_id, | 189 void OnLazyBackgroundPageIdle(const std::string& extension_id, |
186 int sequence_id); | 190 int sequence_id); |
187 void OnLazyBackgroundPageActive(const std::string& extension_id); | 191 void OnLazyBackgroundPageActive(const std::string& extension_id); |
188 void CloseLazyBackgroundPageNow(const std::string& extension_id); | 192 void CloseLazyBackgroundPageNow(const std::string& extension_id, |
| 193 int sequence_id); |
189 | 194 |
190 // Updates a potentially-registered RenderViewHost once it has been | 195 // Updates a potentially-registered RenderViewHost once it has been |
191 // associated with a WebContents. This allows us to gather information that | 196 // associated with a WebContents. This allows us to gather information that |
192 // was not available when the host was first registered. | 197 // was not available when the host was first registered. |
193 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); | 198 void UpdateRegisteredRenderView(content::RenderViewHost* render_view_host); |
194 | 199 |
195 // Clears background page data for this extension. | 200 // Clears background page data for this extension. |
196 void ClearBackgroundPageData(const std::string& extension_id); | 201 void ClearBackgroundPageData(const std::string& extension_id); |
197 | 202 |
198 BackgroundPageDataMap background_page_data_; | 203 BackgroundPageDataMap background_page_data_; |
199 | 204 |
200 // The time to delay between an extension becoming idle and | 205 // The time to delay between an extension becoming idle and |
201 // sending a ShouldUnload message; read from command-line switch. | 206 // sending a ShouldUnload message; read from command-line switch. |
202 base::TimeDelta event_page_idle_time_; | 207 base::TimeDelta event_page_idle_time_; |
203 | 208 |
204 // The time to delay between sending a ShouldUnload message and | 209 // The time to delay between sending a ShouldUnload message and |
205 // sending a Unload message; read from command-line switch. | 210 // sending a Unload message; read from command-line switch. |
206 base::TimeDelta event_page_unloading_time_; | 211 base::TimeDelta event_page_unloading_time_; |
207 | 212 |
208 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; | 213 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; |
209 | 214 |
210 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 215 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
211 }; | 216 }; |
212 | 217 |
213 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 218 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |