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 "chrome/common/view_type.h" | |
17 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.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 RenderViewHost; | 25 class RenderViewHost; |
26 class SiteInstance; | 26 class SiteInstance; |
27 }; | 27 }; |
28 | 28 |
(...skipping 20 matching lines...) Expand all Loading... |
49 typedef std::set<content::RenderViewHost*> ViewSet; | 49 typedef std::set<content::RenderViewHost*> ViewSet; |
50 const ViewSet GetAllViews() const; | 50 const ViewSet GetAllViews() const; |
51 | 51 |
52 // Creates a new ExtensionHost with its associated view, grouping it in the | 52 // Creates a new ExtensionHost with its associated view, grouping it in the |
53 // appropriate SiteInstance (and therefore process) based on the URL and | 53 // appropriate SiteInstance (and therefore process) based on the URL and |
54 // profile. | 54 // profile. |
55 virtual extensions::ExtensionHost* CreateViewHost( | 55 virtual extensions::ExtensionHost* CreateViewHost( |
56 const extensions::Extension* extension, | 56 const extensions::Extension* extension, |
57 const GURL& url, | 57 const GURL& url, |
58 Browser* browser, | 58 Browser* browser, |
59 chrome::ViewType view_type); | 59 extensions::ViewType view_type); |
60 extensions::ExtensionHost* CreateViewHost(const GURL& url, | 60 extensions::ExtensionHost* CreateViewHost(const GURL& url, |
61 Browser* browser, | 61 Browser* browser, |
62 chrome::ViewType view_type); | 62 extensions::ViewType view_type); |
63 extensions::ExtensionHost* CreatePopupHost( | 63 extensions::ExtensionHost* CreatePopupHost( |
64 const extensions::Extension* extension, | 64 const extensions::Extension* extension, |
65 const GURL& url, | 65 const GURL& url, |
66 Browser* browser); | 66 Browser* browser); |
67 extensions::ExtensionHost* CreatePopupHost(const GURL& url, Browser* browser); | 67 extensions::ExtensionHost* CreatePopupHost(const GURL& url, Browser* browser); |
68 extensions::ExtensionHost* CreateDialogHost(const GURL& url); | 68 extensions::ExtensionHost* CreateDialogHost(const GURL& url); |
69 extensions::ExtensionHost* CreateInfobarHost( | 69 extensions::ExtensionHost* CreateInfobarHost( |
70 const extensions::Extension* extension, | 70 const extensions::Extension* extension, |
71 const GURL& url, | 71 const GURL& url, |
72 Browser* browser); | 72 Browser* browser); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // this profile. We create it in such a way that a new | 170 // this profile. We create it in such a way that a new |
171 // browsing instance is created. This controls process grouping. | 171 // browsing instance is created. This controls process grouping. |
172 scoped_refptr<content::SiteInstance> site_instance_; | 172 scoped_refptr<content::SiteInstance> site_instance_; |
173 | 173 |
174 private: | 174 private: |
175 // Extra information we keep for each extension's background page. | 175 // Extra information we keep for each extension's background page. |
176 struct BackgroundPageData; | 176 struct BackgroundPageData; |
177 typedef std::string ExtensionId; | 177 typedef std::string ExtensionId; |
178 typedef std::map<ExtensionId, BackgroundPageData> BackgroundPageDataMap; | 178 typedef std::map<ExtensionId, BackgroundPageData> BackgroundPageDataMap; |
179 typedef std::map<content::RenderViewHost*, | 179 typedef std::map<content::RenderViewHost*, |
180 chrome::ViewType> ExtensionRenderViews; | 180 extensions::ViewType> ExtensionRenderViews; |
181 | 181 |
182 // Close the given |host| iff it's a background page. | 182 // Close the given |host| iff it's a background page. |
183 void CloseBackgroundHost(extensions::ExtensionHost* host); | 183 void CloseBackgroundHost(extensions::ExtensionHost* host); |
184 | 184 |
185 // Ensure browser object is not null except for certain situations. | 185 // Ensure browser object is not null except for certain situations. |
186 void EnsureBrowserWhenRequired(Browser* browser, | 186 void EnsureBrowserWhenRequired(Browser* browser, |
187 chrome::ViewType view_type); | 187 extensions::ViewType view_type); |
188 | 188 |
189 // These are called when the extension transitions between idle and active. | 189 // These are called when the extension transitions between idle and active. |
190 // They control the process of closing the background page when idle. | 190 // They control the process of closing the background page when idle. |
191 void OnLazyBackgroundPageIdle(const std::string& extension_id, | 191 void OnLazyBackgroundPageIdle(const std::string& extension_id, |
192 int sequence_id); | 192 int sequence_id); |
193 void OnLazyBackgroundPageActive(const std::string& extension_id); | 193 void OnLazyBackgroundPageActive(const std::string& extension_id); |
194 void CloseLazyBackgroundPageNow(const std::string& extension_id, | 194 void CloseLazyBackgroundPageNow(const std::string& extension_id, |
195 int sequence_id); | 195 int sequence_id); |
196 | 196 |
197 // Potentially registers a RenderViewHost, if it is associated with an | 197 // Potentially registers a RenderViewHost, if it is associated with an |
(...skipping 22 matching lines...) Expand all Loading... |
220 // The time to delay between sending a ShouldSuspend message and | 220 // The time to delay between sending a ShouldSuspend message and |
221 // sending a Suspend message; read from command-line switch. | 221 // sending a Suspend message; read from command-line switch. |
222 base::TimeDelta event_page_suspending_time_; | 222 base::TimeDelta event_page_suspending_time_; |
223 | 223 |
224 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; | 224 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; |
225 | 225 |
226 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 226 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
227 }; | 227 }; |
228 | 228 |
229 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 229 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
OLD | NEW |