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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void OnNetworkRequestDone(content::RenderFrameHost* render_frame_host); | 121 void OnNetworkRequestDone(content::RenderFrameHost* render_frame_host); |
122 | 122 |
123 // Prevents |extension|'s background page from being closed and sends the | 123 // Prevents |extension|'s background page from being closed and sends the |
124 // onSuspendCanceled() event to it. | 124 // onSuspendCanceled() event to it. |
125 void CancelSuspend(const Extension* extension); | 125 void CancelSuspend(const Extension* extension); |
126 | 126 |
127 // Creates background hosts if the embedder is ready and they are not already | 127 // Creates background hosts if the embedder is ready and they are not already |
128 // loaded. | 128 // loaded. |
129 void MaybeCreateStartupBackgroundHosts(); | 129 void MaybeCreateStartupBackgroundHosts(); |
130 | 130 |
| 131 // Called on shutdown to close our extension hosts. |
| 132 void CloseBackgroundHosts(); |
| 133 |
131 // Gets the BrowserContext associated with site_instance_ and all other | 134 // Gets the BrowserContext associated with site_instance_ and all other |
132 // related SiteInstances. | 135 // related SiteInstances. |
133 content::BrowserContext* GetBrowserContext() const; | 136 content::BrowserContext* GetBrowserContext() const; |
134 | 137 |
135 // Sets callbacks for testing keepalive impulse behavior. | 138 // Sets callbacks for testing keepalive impulse behavior. |
136 typedef base::Callback<void(const std::string& extension_id)> | 139 typedef base::Callback<void(const std::string& extension_id)> |
137 ImpulseCallbackForTesting; | 140 ImpulseCallbackForTesting; |
138 void SetKeepaliveImpulseCallbackForTesting( | 141 void SetKeepaliveImpulseCallbackForTesting( |
139 const ImpulseCallbackForTesting& callback); | 142 const ImpulseCallbackForTesting& callback); |
140 void SetKeepaliveImpulseDecrementCallbackForTesting( | 143 void SetKeepaliveImpulseDecrementCallbackForTesting( |
(...skipping 17 matching lines...) Expand all Loading... |
158 } | 161 } |
159 | 162 |
160 protected: | 163 protected: |
161 // If |context| is incognito pass the master context as |original_context|. | 164 // If |context| is incognito pass the master context as |original_context|. |
162 // Otherwise pass the same context for both. Pass the ExtensionRegistry for | 165 // Otherwise pass the same context for both. Pass the ExtensionRegistry for |
163 // |context| as |registry|, or override it for testing. | 166 // |context| as |registry|, or override it for testing. |
164 ProcessManager(content::BrowserContext* context, | 167 ProcessManager(content::BrowserContext* context, |
165 content::BrowserContext* original_context, | 168 content::BrowserContext* original_context, |
166 ExtensionRegistry* registry); | 169 ExtensionRegistry* registry); |
167 | 170 |
168 // Called on browser shutdown to close our extension hosts. | |
169 void CloseBackgroundHosts(); | |
170 | |
171 // content::NotificationObserver: | 171 // content::NotificationObserver: |
172 virtual void Observe(int type, | 172 virtual void Observe(int type, |
173 const content::NotificationSource& source, | 173 const content::NotificationSource& source, |
174 const content::NotificationDetails& details) OVERRIDE; | 174 const content::NotificationDetails& details) OVERRIDE; |
175 | 175 |
176 content::NotificationRegistrar registrar_; | 176 content::NotificationRegistrar registrar_; |
177 | 177 |
178 // The set of ExtensionHosts running viewless background extensions. | 178 // The set of ExtensionHosts running viewless background extensions. |
179 ExtensionHostSet background_hosts_; | 179 ExtensionHostSet background_hosts_; |
180 | 180 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 278 |
279 // Must be last member, see doc on WeakPtrFactory. | 279 // Must be last member, see doc on WeakPtrFactory. |
280 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; | 280 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; |
281 | 281 |
282 DISALLOW_COPY_AND_ASSIGN(ProcessManager); | 282 DISALLOW_COPY_AND_ASSIGN(ProcessManager); |
283 }; | 283 }; |
284 | 284 |
285 } // namespace extensions | 285 } // namespace extensions |
286 | 286 |
287 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 287 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
OLD | NEW |