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. When callbacks | |
125 // return true they must be released to free refcounted resources. | |
yzshen1
2014/01/03 22:10:10
It seems there are two ways:
1) keep the void retu
scheib
2014/01/03 23:11:29
I've changed to having the tests clear the callbac
| |
126 typedef base::Callback<bool(const std::string& extension_id)> | |
127 ImpulseCallbackForTesting; | |
128 void SetKeepaliveImpulseCallbackForTesting( | |
129 const ImpulseCallbackForTesting& callback); | |
130 void SetKeepaliveImpulseDecrementCallbackForTesting( | |
131 const ImpulseCallbackForTesting& callback); | |
132 | |
124 protected: | 133 protected: |
125 // If |context| is incognito pass the master context as |original_context|. | 134 // If |context| is incognito pass the master context as |original_context|. |
126 // Otherwise pass the same context for both. | 135 // Otherwise pass the same context for both. |
127 ProcessManager(content::BrowserContext* context, | 136 ProcessManager(content::BrowserContext* context, |
128 content::BrowserContext* original_context); | 137 content::BrowserContext* original_context); |
129 | 138 |
130 // Called on browser shutdown to close our extension hosts. | 139 // Called on browser shutdown to close our extension hosts. |
131 void CloseBackgroundHosts(); | 140 void CloseBackgroundHosts(); |
132 | 141 |
133 // content::NotificationObserver: | 142 // content::NotificationObserver: |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 | 218 |
210 // The time to delay between sending a ShouldSuspend message and | 219 // The time to delay between sending a ShouldSuspend message and |
211 // sending a Suspend message; read from command-line switch. | 220 // sending a Suspend message; read from command-line switch. |
212 base::TimeDelta event_page_suspending_time_; | 221 base::TimeDelta event_page_suspending_time_; |
213 | 222 |
214 // True if we have created the startup set of background hosts. | 223 // True if we have created the startup set of background hosts. |
215 bool startup_background_hosts_created_; | 224 bool startup_background_hosts_created_; |
216 | 225 |
217 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; | 226 base::Callback<void(content::DevToolsAgentHost*, bool)> devtools_callback_; |
218 | 227 |
228 ImpulseCallbackForTesting keepalive_impulse_callback_for_testing_; | |
229 ImpulseCallbackForTesting keepalive_impulse_decrement_callback_for_testing_; | |
230 | |
219 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; | 231 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; |
220 | 232 |
221 DISALLOW_COPY_AND_ASSIGN(ProcessManager); | 233 DISALLOW_COPY_AND_ASSIGN(ProcessManager); |
222 }; | 234 }; |
223 | 235 |
224 } // namespace extensions | 236 } // namespace extensions |
225 | 237 |
226 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 238 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
OLD | NEW |