OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 5 #ifndef EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
6 #define EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 6 #define EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // onSuspendCanceled() event to it. | 114 // onSuspendCanceled() event to it. |
115 void CancelSuspend(const Extension* extension); | 115 void CancelSuspend(const Extension* extension); |
116 | 116 |
117 // Ensures background hosts are loaded for a new browser window. | 117 // Ensures background hosts are loaded for a new browser window. |
118 void OnBrowserWindowReady(); | 118 void OnBrowserWindowReady(); |
119 | 119 |
120 // Gets the BrowserContext associated with site_instance_ and all other | 120 // Gets the BrowserContext associated with site_instance_ and all other |
121 // related SiteInstances. | 121 // related SiteInstances. |
122 content::BrowserContext* GetBrowserContext() const; | 122 content::BrowserContext* GetBrowserContext() const; |
123 | 123 |
| 124 // Sets callbacks for testing keepalive impulse behavior. |
| 125 typedef base::Callback<void(const std::string& extension_id)> |
| 126 ImpulseCallbackForTesting; |
| 127 void SetKeepaliveImpulseCallbackForTesting( |
| 128 const ImpulseCallbackForTesting& callback); |
| 129 void SetKeepaliveImpulseDecrementCallbackForTesting( |
| 130 const ImpulseCallbackForTesting& callback); |
| 131 |
124 protected: | 132 protected: |
125 // If |context| is incognito pass the master context as |original_context|. | 133 // If |context| is incognito pass the master context as |original_context|. |
126 // Otherwise pass the same context for both. | 134 // Otherwise pass the same context for both. |
127 ProcessManager(content::BrowserContext* context, | 135 ProcessManager(content::BrowserContext* context, |
128 content::BrowserContext* original_context); | 136 content::BrowserContext* original_context); |
129 | 137 |
130 // Called on browser shutdown to close our extension hosts. | 138 // Called on browser shutdown to close our extension hosts. |
131 void CloseBackgroundHosts(); | 139 void CloseBackgroundHosts(); |
132 | 140 |
133 // content::NotificationObserver: | 141 // content::NotificationObserver: |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 217 |
210 // The time to delay between sending a ShouldSuspend message and | 218 // The time to delay between sending a ShouldSuspend message and |
211 // sending a Suspend message; read from command-line switch. | 219 // sending a Suspend message; read from command-line switch. |
212 base::TimeDelta event_page_suspending_time_; | 220 base::TimeDelta event_page_suspending_time_; |
213 | 221 |
214 // True if we have created the startup set of background hosts. | 222 // True if we have created the startup set of background hosts. |
215 bool startup_background_hosts_created_; | 223 bool startup_background_hosts_created_; |
216 | 224 |
217 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; | 225 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; |
218 | 226 |
| 227 ImpulseCallbackForTesting keepalive_impulse_callback_for_testing_; |
| 228 ImpulseCallbackForTesting keepalive_impulse_decrement_callback_for_testing_; |
| 229 |
219 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; | 230 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; |
220 | 231 |
221 DISALLOW_COPY_AND_ASSIGN(ProcessManager); | 232 DISALLOW_COPY_AND_ASSIGN(ProcessManager); |
222 }; | 233 }; |
223 | 234 |
224 } // namespace extensions | 235 } // namespace extensions |
225 | 236 |
226 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 237 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
OLD | NEW |