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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
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 "content/public/common/view_type.h" | 15 #include "content/public/common/view_type.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 | 18 |
19 class Browser; | 19 class Browser; |
20 class BrowsingInstance; | |
21 class Extension; | 20 class Extension; |
22 class ExtensionHost; | 21 class ExtensionHost; |
23 class GURL; | 22 class GURL; |
24 class Profile; | 23 class Profile; |
25 class RenderViewHost; | 24 class RenderViewHost; |
26 class SiteInstance; | 25 class SiteInstance; |
27 | 26 |
28 // Manages dynamic state of running Chromium extensions. There is one instance | 27 // Manages dynamic state of running Chromium extensions. There is one instance |
29 // of this class per Profile. OTR Profiles have a separate instance that keeps | 28 // of this class per Profile. OTR Profiles have a separate instance that keeps |
30 // track of split-mode extensions only. | 29 // track of split-mode extensions only. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void OnExtensionHostCreated(ExtensionHost* host, bool is_background); | 102 void OnExtensionHostCreated(ExtensionHost* host, bool is_background); |
104 | 103 |
105 // Called on browser shutdown to close our extension hosts. | 104 // Called on browser shutdown to close our extension hosts. |
106 void CloseBackgroundHosts(); | 105 void CloseBackgroundHosts(); |
107 | 106 |
108 // content::NotificationObserver: | 107 // content::NotificationObserver: |
109 virtual void Observe(int type, | 108 virtual void Observe(int type, |
110 const content::NotificationSource& source, | 109 const content::NotificationSource& source, |
111 const content::NotificationDetails& details) OVERRIDE; | 110 const content::NotificationDetails& details) OVERRIDE; |
112 | 111 |
| 112 // Gets the profile associated with site_instance_ and all other |
| 113 // related SiteInstances. |
| 114 Profile* GetProfile() const; |
| 115 |
113 content::NotificationRegistrar registrar_; | 116 content::NotificationRegistrar registrar_; |
114 | 117 |
115 // The set of all ExtensionHosts managed by this process manager. | 118 // The set of all ExtensionHosts managed by this process manager. |
116 ExtensionHostSet all_hosts_; | 119 ExtensionHostSet all_hosts_; |
117 | 120 |
118 // The set of running viewless background extensions. | 121 // The set of running viewless background extensions. |
119 ExtensionHostSet background_hosts_; | 122 ExtensionHostSet background_hosts_; |
120 | 123 |
121 // The BrowsingInstance shared by all extensions in this profile. This | 124 // A SiteInstance related to the SiteInstance for all extensions in |
122 // controls process grouping. | 125 // this profile. We create it in such a way that a new |
123 scoped_refptr<BrowsingInstance> browsing_instance_; | 126 // browsing instance is created. This controls process grouping. |
| 127 scoped_refptr<SiteInstance> site_instance_; |
124 | 128 |
125 private: | 129 private: |
126 // Contains all extension-related RenderViewHost instances for all extensions. | 130 // Contains all extension-related RenderViewHost instances for all extensions. |
127 typedef std::set<RenderViewHost*> RenderViewHostSet; | 131 typedef std::set<RenderViewHost*> RenderViewHostSet; |
128 RenderViewHostSet all_extension_views_; | 132 RenderViewHostSet all_extension_views_; |
129 | 133 |
130 // Close the given |host| iff it's a background page. | 134 // Close the given |host| iff it's a background page. |
131 void CloseBackgroundHost(ExtensionHost* host); | 135 void CloseBackgroundHost(ExtensionHost* host); |
132 | 136 |
133 // Excludes background page. | 137 // Excludes background page. |
134 bool HasVisibleViews(const std::string& extension_id); | 138 bool HasVisibleViews(const std::string& extension_id); |
135 | 139 |
136 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 140 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
137 }; | 141 }; |
138 | 142 |
139 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 143 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |