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