OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 #include "extensions/common/view_type.h" | 18 #include "extensions/common/view_type.h" |
19 | 19 |
20 class Browser; | 20 class Browser; |
21 class GURL; | 21 class GURL; |
22 class Profile; | 22 class Profile; |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 class RenderProcessHostFactory; | |
25 class RenderViewHost; | 26 class RenderViewHost; |
26 class SiteInstance; | 27 class SiteInstance; |
27 }; | 28 }; |
28 | 29 |
29 namespace extensions { | 30 namespace extensions { |
30 class Extension; | 31 class Extension; |
31 class ExtensionHost; | 32 class ExtensionHost; |
32 } | 33 } |
33 | 34 |
34 // Manages dynamic state of running Chromium extensions. There is one instance | 35 // Manages dynamic state of running Chromium extensions. There is one instance |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 | 132 |
132 // Tracks network requests for a given RenderViewHost, used to know | 133 // Tracks network requests for a given RenderViewHost, used to know |
133 // when network activity is idle for lazy background pages. | 134 // when network activity is idle for lazy background pages. |
134 void OnNetworkRequestStarted(content::RenderViewHost* render_view_host); | 135 void OnNetworkRequestStarted(content::RenderViewHost* render_view_host); |
135 void OnNetworkRequestDone(content::RenderViewHost* render_view_host); | 136 void OnNetworkRequestDone(content::RenderViewHost* render_view_host); |
136 | 137 |
137 // Prevents |extension|'s background page from being closed and sends the | 138 // Prevents |extension|'s background page from being closed and sends the |
138 // onSuspendCanceled() event to it. | 139 // onSuspendCanceled() event to it. |
139 void CancelSuspend(const extensions::Extension* extension); | 140 void CancelSuspend(const extensions::Extension* extension); |
140 | 141 |
142 // Retrieves the base SiteInstance that is used to create the SiteInstances | |
143 // for all extensions in this profile. | |
144 content::SiteInstance* GetSiteInstanceForTest() { | |
Paweł Hajdan Jr.
2013/04/08 20:03:51
nit: I don't think this needs to be inline. Please
Jeffrey Yasskin
2013/04/08 22:09:38
You're saying that if I call it "site_instance_for
Paweł Hajdan Jr.
2013/04/08 22:17:38
Yes, that would be fine for me.
Jeffrey Yasskin
2013/04/08 22:38:02
Done.
| |
145 return site_instance_.get(); | |
146 } | |
147 | |
141 protected: | 148 protected: |
142 explicit ExtensionProcessManager(Profile* profile); | 149 explicit ExtensionProcessManager(Profile* profile); |
143 | 150 |
144 // Called just after |host| is created so it can be registered in our lists. | 151 // Called just after |host| is created so it can be registered in our lists. |
145 void OnExtensionHostCreated(extensions::ExtensionHost* host, | 152 void OnExtensionHostCreated(extensions::ExtensionHost* host, |
146 bool is_background); | 153 bool is_background); |
147 | 154 |
148 // Called on browser shutdown to close our extension hosts. | 155 // Called on browser shutdown to close our extension hosts. |
149 void CloseBackgroundHosts(); | 156 void CloseBackgroundHosts(); |
150 | 157 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
220 // The time to delay between sending a ShouldSuspend message and | 227 // The time to delay between sending a ShouldSuspend message and |
221 // sending a Suspend message; read from command-line switch. | 228 // sending a Suspend message; read from command-line switch. |
222 base::TimeDelta event_page_suspending_time_; | 229 base::TimeDelta event_page_suspending_time_; |
223 | 230 |
224 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; | 231 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; |
225 | 232 |
226 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 233 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
227 }; | 234 }; |
228 | 235 |
229 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 236 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |