| 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 "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "content/public/common/view_type.h" | 17 #include "chrome/common/view_type.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 | 20 |
| 21 class Browser; | 21 class Browser; |
| 22 class ExtensionHost; | 22 class ExtensionHost; |
| 23 class GURL; | 23 class GURL; |
| 24 class Profile; | 24 class Profile; |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 class RenderViewHost; | 27 class RenderViewHost; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 49 | 49 |
| 50 typedef std::set<content::RenderViewHost*> ViewSet; | 50 typedef std::set<content::RenderViewHost*> ViewSet; |
| 51 const ViewSet GetAllViews() const; | 51 const ViewSet GetAllViews() const; |
| 52 | 52 |
| 53 // Creates a new ExtensionHost with its associated view, grouping it in the | 53 // Creates a new ExtensionHost with its associated view, grouping it in the |
| 54 // appropriate SiteInstance (and therefore process) based on the URL and | 54 // appropriate SiteInstance (and therefore process) based on the URL and |
| 55 // profile. | 55 // profile. |
| 56 virtual ExtensionHost* CreateViewHost(const extensions::Extension* extension, | 56 virtual ExtensionHost* CreateViewHost(const extensions::Extension* extension, |
| 57 const GURL& url, | 57 const GURL& url, |
| 58 Browser* browser, | 58 Browser* browser, |
| 59 content::ViewType view_type); | 59 chrome::ViewType view_type); |
| 60 ExtensionHost* CreateViewHost(const GURL& url, | 60 ExtensionHost* CreateViewHost(const GURL& url, |
| 61 Browser* browser, | 61 Browser* browser, |
| 62 content::ViewType view_type); | 62 chrome::ViewType view_type); |
| 63 ExtensionHost* CreatePopupHost(const extensions::Extension* extension, | 63 ExtensionHost* CreatePopupHost(const extensions::Extension* extension, |
| 64 const GURL& url, | 64 const GURL& url, |
| 65 Browser* browser); | 65 Browser* browser); |
| 66 ExtensionHost* CreatePopupHost(const GURL& url, Browser* browser); | 66 ExtensionHost* CreatePopupHost(const GURL& url, Browser* browser); |
| 67 ExtensionHost* CreateDialogHost(const GURL& url, Browser* browser); | 67 ExtensionHost* CreateDialogHost(const GURL& url, Browser* browser); |
| 68 ExtensionHost* CreateInfobarHost(const extensions::Extension* extension, | 68 ExtensionHost* CreateInfobarHost(const extensions::Extension* extension, |
| 69 const GURL& url, | 69 const GURL& url, |
| 70 Browser* browser); | 70 Browser* browser); |
| 71 ExtensionHost* CreateInfobarHost(const GURL& url, | 71 ExtensionHost* CreateInfobarHost(const GURL& url, |
| 72 Browser* browser); | 72 Browser* browser); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 private: | 164 private: |
| 165 // Extra information we keep for each extension's background page. | 165 // Extra information we keep for each extension's background page. |
| 166 struct BackgroundPageData; | 166 struct BackgroundPageData; |
| 167 typedef std::string ExtensionId; | 167 typedef std::string ExtensionId; |
| 168 typedef std::map<ExtensionId, BackgroundPageData> BackgroundPageDataMap; | 168 typedef std::map<ExtensionId, BackgroundPageData> BackgroundPageDataMap; |
| 169 | 169 |
| 170 // Contains all extension-related RenderViewHost instances for all extensions. | 170 // Contains all extension-related RenderViewHost instances for all extensions. |
| 171 // We also keep a cache of the host's view type, because that information | 171 // We also keep a cache of the host's view type, because that information |
| 172 // is not accessible at registration/deregistration time. | 172 // is not accessible at registration/deregistration time. |
| 173 typedef std::map<content::RenderViewHost*, | 173 typedef std::map<content::RenderViewHost*, |
| 174 content::ViewType> ExtensionRenderViews; | 174 chrome::ViewType> ExtensionRenderViews; |
| 175 ExtensionRenderViews all_extension_views_; | 175 ExtensionRenderViews all_extension_views_; |
| 176 | 176 |
| 177 // Close the given |host| iff it's a background page. | 177 // Close the given |host| iff it's a background page. |
| 178 void CloseBackgroundHost(ExtensionHost* host); | 178 void CloseBackgroundHost(ExtensionHost* host); |
| 179 | 179 |
| 180 // Ensure browser object is not null except for certain situations. | 180 // Ensure browser object is not null except for certain situations. |
| 181 void EnsureBrowserWhenRequired(Browser* browser, | 181 void EnsureBrowserWhenRequired(Browser* browser, |
| 182 content::ViewType view_type); | 182 chrome::ViewType view_type); |
| 183 | 183 |
| 184 // These are called when the extension transitions between idle and active. | 184 // These are called when the extension transitions between idle and active. |
| 185 // They control the process of closing the background page when idle. | 185 // They control the process of closing the background page when idle. |
| 186 void OnLazyBackgroundPageIdle(const std::string& extension_id, | 186 void OnLazyBackgroundPageIdle(const std::string& extension_id, |
| 187 int sequence_id); | 187 int sequence_id); |
| 188 void OnLazyBackgroundPageActive(const std::string& extension_id); | 188 void OnLazyBackgroundPageActive(const std::string& extension_id); |
| 189 void CloseLazyBackgroundPageNow(const std::string& extension_id); | 189 void CloseLazyBackgroundPageNow(const std::string& extension_id); |
| 190 | 190 |
| 191 // Updates a potentially-registered RenderViewHost once it has been | 191 // Updates a potentially-registered RenderViewHost once it has been |
| 192 // associated with a WebContents. This allows us to gather information that | 192 // associated with a WebContents. This allows us to gather information that |
| (...skipping 12 matching lines...) Expand all Loading... |
| 205 // The time to delay between sending a ShouldUnload message and | 205 // The time to delay between sending a ShouldUnload message and |
| 206 // sending a Unload message; read from command-line switch. | 206 // sending a Unload message; read from command-line switch. |
| 207 base::TimeDelta event_page_unloading_time_; | 207 base::TimeDelta event_page_unloading_time_; |
| 208 | 208 |
| 209 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; | 209 base::WeakPtrFactory<ExtensionProcessManager> weak_ptr_factory_; |
| 210 | 210 |
| 211 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); | 211 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); |
| 212 }; | 212 }; |
| 213 | 213 |
| 214 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ | 214 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ |
| OLD | NEW |