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 | |
131 protected: | 123 protected: |
132 // If |context| is incognito pass the master context as |original_context|. | 124 // If |context| is incognito pass the master context as |original_context|. |
133 // Otherwise pass the same context for both. | 125 // Otherwise pass the same context for both. |
134 ProcessManager(content::BrowserContext* context, | 126 ProcessManager(content::BrowserContext* context, |
135 content::BrowserContext* original_context); | 127 content::BrowserContext* original_context); |
136 | 128 |
137 // Called on browser shutdown to close our extension hosts. | 129 // Called on browser shutdown to close our extension hosts. |
138 void CloseBackgroundHosts(); | 130 void CloseBackgroundHosts(); |
139 | 131 |
140 // content::NotificationObserver: | 132 // content::NotificationObserver: |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 208 |
217 // The time to delay between sending a ShouldSuspend message and | 209 // The time to delay between sending a ShouldSuspend message and |
218 // sending a Suspend message; read from command-line switch. | 210 // sending a Suspend message; read from command-line switch. |
219 base::TimeDelta event_page_suspending_time_; | 211 base::TimeDelta event_page_suspending_time_; |
220 | 212 |
221 // True if we have created the startup set of background hosts. | 213 // True if we have created the startup set of background hosts. |
222 bool startup_background_hosts_created_; | 214 bool startup_background_hosts_created_; |
223 | 215 |
224 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; | 216 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; |
225 | 217 |
226 ImpulseCallbackForTesting keepalive_impulse_callback_for_testing_; | |
227 ImpulseCallbackForTesting keepalive_impulse_decrement_callback_for_testing_; | |
228 | |
229 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; | 218 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; |
230 | 219 |
231 DISALLOW_COPY_AND_ASSIGN(ProcessManager); | 220 DISALLOW_COPY_AND_ASSIGN(ProcessManager); |
232 }; | 221 }; |
233 | 222 |
234 } // namespace extensions | 223 } // namespace extensions |
235 | 224 |
236 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 225 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
OLD | NEW |