Chromium Code Reviews| 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 // Installs |rph_factory| into the SiteInstance shared by all extensions in | |
| 143 // this profile. This must be called before any ExtensionHosts are created | |
| 144 // (to avoid having multiple kinds of RenderProcessHosts), and |rph_factory| | |
| 145 // must outlive the profile. | |
| 146 void SetRenderProcessHostFactoryForTest( | |
|
Paweł Hajdan Jr.
2013/04/04 21:30:05
Why not just use SiteInstance directly? More layer
Jeffrey Yasskin
2013/04/05 13:14:01
i.e. GetSiteInstanceForTest()->SetRenderProcessHos
| |
| 147 content::RenderProcessHostFactory* rph_factory); | |
| 148 | |
| 141 protected: | 149 protected: |
| 142 explicit ExtensionProcessManager(Profile* profile); | 150 explicit ExtensionProcessManager(Profile* profile); |
| 143 | 151 |
| 144 // Called just after |host| is created so it can be registered in our lists. | 152 // Called just after |host| is created so it can be registered in our lists. |
| 145 void OnExtensionHostCreated(extensions::ExtensionHost* host, | 153 void OnExtensionHostCreated(extensions::ExtensionHost* host, |
| 146 bool is_background); | 154 bool is_background); |
| 147 | 155 |
| 148 // Called on browser shutdown to close our extension hosts. | 156 // Called on browser shutdown to close our extension hosts. |
| 149 void CloseBackgroundHosts(); | 157 void CloseBackgroundHosts(); |
| 150 | 158 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 // The time to delay between sending a ShouldSuspend message and | 228 // The time to delay between sending a ShouldSuspend message and |
| 221 // sending a Suspend message; read from command-line switch. | 229 // sending a Suspend message; read from command-line switch. |
| 222 base::TimeDelta event_page_suspending_time_; | 230 base::TimeDelta event_page_suspending_time_; |
| 223 | 231 |
| 224 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; | 232 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; |
| 225 | 233 |
| 226 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 234 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
| 227 }; | 235 }; |
| 228 | 236 |
| 229 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 237 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
| OLD | NEW |