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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // background hosts will be created. Defaults to false. | 118 // background hosts will be created. Defaults to false. |
119 void DeferBackgroundHostCreation(bool defer); | 119 void DeferBackgroundHostCreation(bool defer); |
120 | 120 |
121 // Ensures background hosts are loaded for a new browser window. | 121 // Ensures background hosts are loaded for a new browser window. |
122 void OnBrowserWindowReady(); | 122 void OnBrowserWindowReady(); |
123 | 123 |
124 // Gets the BrowserContext associated with site_instance_ and all other | 124 // Gets the BrowserContext associated with site_instance_ and all other |
125 // related SiteInstances. | 125 // related SiteInstances. |
126 content::BrowserContext* GetBrowserContext() const; | 126 content::BrowserContext* GetBrowserContext() const; |
127 | 127 |
| 128 // Sets callbacks for testing keepalive impulse behavior. |
| 129 typedef base::Callback<void(const std::string& extension_id)> |
| 130 ImpulseCallbackForTesting; |
| 131 void SetKeepaliveImpulseCallbackForTesting( |
| 132 const ImpulseCallbackForTesting& callback); |
| 133 void SetKeepaliveImpulseDecrementCallbackForTesting( |
| 134 const ImpulseCallbackForTesting& callback); |
| 135 |
128 protected: | 136 protected: |
129 // If |context| is incognito pass the master context as |original_context|. | 137 // If |context| is incognito pass the master context as |original_context|. |
130 // Otherwise pass the same context for both. | 138 // Otherwise pass the same context for both. |
131 ProcessManager(content::BrowserContext* context, | 139 ProcessManager(content::BrowserContext* context, |
132 content::BrowserContext* original_context); | 140 content::BrowserContext* original_context); |
133 | 141 |
134 // Called on browser shutdown to close our extension hosts. | 142 // Called on browser shutdown to close our extension hosts. |
135 void CloseBackgroundHosts(); | 143 void CloseBackgroundHosts(); |
136 | 144 |
137 // content::NotificationObserver: | 145 // content::NotificationObserver: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 base::TimeDelta event_page_suspending_time_; | 224 base::TimeDelta event_page_suspending_time_; |
217 | 225 |
218 // If true, then creation of background hosts is suspended. | 226 // If true, then creation of background hosts is suspended. |
219 bool defer_background_host_creation_; | 227 bool defer_background_host_creation_; |
220 | 228 |
221 // True if we have created the startup set of background hosts. | 229 // True if we have created the startup set of background hosts. |
222 bool startup_background_hosts_created_; | 230 bool startup_background_hosts_created_; |
223 | 231 |
224 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; | 232 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; |
225 | 233 |
| 234 ImpulseCallbackForTesting keepalive_impulse_callback_for_testing_; |
| 235 ImpulseCallbackForTesting keepalive_impulse_decrement_callback_for_testing_; |
| 236 |
226 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; | 237 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; |
227 | 238 |
228 DISALLOW_COPY_AND_ASSIGN(ProcessManager); | 239 DISALLOW_COPY_AND_ASSIGN(ProcessManager); |
229 }; | 240 }; |
230 | 241 |
231 } // namespace extensions | 242 } // namespace extensions |
232 | 243 |
233 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 244 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
OLD | NEW |