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> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 #include "extensions/browser/extension_registry_observer.h" | |
21 #include "extensions/common/view_type.h" | 20 #include "extensions/common/view_type.h" |
22 | 21 |
23 class GURL; | 22 class GURL; |
24 | 23 |
25 namespace content { | 24 namespace content { |
26 class BrowserContext; | 25 class BrowserContext; |
27 class DevToolsAgentHost; | 26 class DevToolsAgentHost; |
28 class RenderViewHost; | 27 class RenderViewHost; |
29 class RenderFrameHost; | 28 class RenderFrameHost; |
30 class SiteInstance; | 29 class SiteInstance; |
31 }; | 30 }; |
32 | 31 |
33 namespace extensions { | 32 namespace extensions { |
34 | 33 |
35 class Extension; | 34 class Extension; |
36 class ExtensionHost; | 35 class ExtensionHost; |
37 class ExtensionRegistry; | 36 class ExtensionRegistry; |
38 class ProcessManagerDelegate; | 37 class ProcessManagerDelegate; |
39 class ProcessManagerObserver; | 38 class ProcessManagerObserver; |
40 | 39 |
41 // Manages dynamic state of running Chromium extensions. There is one instance | 40 // Manages dynamic state of running Chromium extensions. There is one instance |
42 // of this class per Profile. OTR Profiles have a separate instance that keeps | 41 // of this class per Profile. OTR Profiles have a separate instance that keeps |
43 // track of split-mode extensions only. | 42 // track of split-mode extensions only. |
44 class ProcessManager : public content::NotificationObserver, | 43 class ProcessManager : public content::NotificationObserver { |
45 public extensions::ExtensionRegistryObserver { | |
46 public: | 44 public: |
47 typedef std::set<extensions::ExtensionHost*> ExtensionHostSet; | 45 typedef std::set<extensions::ExtensionHost*> ExtensionHostSet; |
48 typedef ExtensionHostSet::const_iterator const_iterator; | 46 typedef ExtensionHostSet::const_iterator const_iterator; |
49 | 47 |
50 static ProcessManager* Create(content::BrowserContext* context); | 48 static ProcessManager* Create(content::BrowserContext* context); |
51 virtual ~ProcessManager(); | 49 virtual ~ProcessManager(); |
52 | 50 |
53 const ExtensionHostSet& background_hosts() const { | 51 const ExtensionHostSet& background_hosts() const { |
54 return background_hosts_; | 52 return background_hosts_; |
55 } | 53 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // |context| as |registry|, or override it for testing. | 171 // |context| as |registry|, or override it for testing. |
174 ProcessManager(content::BrowserContext* context, | 172 ProcessManager(content::BrowserContext* context, |
175 content::BrowserContext* original_context, | 173 content::BrowserContext* original_context, |
176 ExtensionRegistry* registry); | 174 ExtensionRegistry* registry); |
177 | 175 |
178 // content::NotificationObserver: | 176 // content::NotificationObserver: |
179 virtual void Observe(int type, | 177 virtual void Observe(int type, |
180 const content::NotificationSource& source, | 178 const content::NotificationSource& source, |
181 const content::NotificationDetails& details) OVERRIDE; | 179 const content::NotificationDetails& details) OVERRIDE; |
182 | 180 |
183 // extensions::ExtensionRegistryObserver: | |
184 virtual void OnExtensionLoaded( | |
185 content::BrowserContext* browser_context, | |
186 const extensions::Extension* extension) OVERRIDE; | |
187 | |
188 virtual void OnExtensionUnloaded( | |
189 content::BrowserContext* browser_context, | |
190 const extensions::Extension* extension, | |
191 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; | |
192 | |
193 content::NotificationRegistrar registrar_; | 181 content::NotificationRegistrar registrar_; |
194 | 182 |
195 // The set of ExtensionHosts running viewless background extensions. | 183 // The set of ExtensionHosts running viewless background extensions. |
196 ExtensionHostSet background_hosts_; | 184 ExtensionHostSet background_hosts_; |
197 | 185 |
198 // A SiteInstance related to the SiteInstance for all extensions in | 186 // A SiteInstance related to the SiteInstance for all extensions in |
199 // this profile. We create it in such a way that a new | 187 // this profile. We create it in such a way that a new |
200 // browsing instance is created. This controls process grouping. | 188 // browsing instance is created. This controls process grouping. |
201 scoped_refptr<content::SiteInstance> site_instance_; | 189 scoped_refptr<content::SiteInstance> site_instance_; |
202 | 190 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 283 |
296 // Must be last member, see doc on WeakPtrFactory. | 284 // Must be last member, see doc on WeakPtrFactory. |
297 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; | 285 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; |
298 | 286 |
299 DISALLOW_COPY_AND_ASSIGN(ProcessManager); | 287 DISALLOW_COPY_AND_ASSIGN(ProcessManager); |
300 }; | 288 }; |
301 | 289 |
302 } // namespace extensions | 290 } // namespace extensions |
303 | 291 |
304 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 292 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
OLD | NEW |