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