| 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> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 | 39 |
| 40 // Manages dynamic state of running Chromium extensions. There is one instance | 40 // Manages dynamic state of running Chromium extensions. There is one instance |
| 41 // 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 |
| 42 // track of split-mode extensions only. | 42 // track of split-mode extensions only. |
| 43 class ProcessManager : public content::NotificationObserver { | 43 class ProcessManager : public content::NotificationObserver { |
| 44 public: | 44 public: |
| 45 typedef std::set<extensions::ExtensionHost*> ExtensionHostSet; | 45 typedef std::set<extensions::ExtensionHost*> ExtensionHostSet; |
| 46 typedef ExtensionHostSet::const_iterator const_iterator; | 46 typedef ExtensionHostSet::const_iterator const_iterator; |
| 47 | 47 |
| 48 static ProcessManager* Create(content::BrowserContext* context); | 48 static ProcessManager* Create(content::BrowserContext* context); |
| 49 virtual ~ProcessManager(); | 49 ~ProcessManager() override; |
| 50 | 50 |
| 51 const ExtensionHostSet& background_hosts() const { | 51 const ExtensionHostSet& background_hosts() const { |
| 52 return background_hosts_; | 52 return background_hosts_; |
| 53 } | 53 } |
| 54 | 54 |
| 55 typedef std::set<content::RenderViewHost*> ViewSet; | 55 typedef std::set<content::RenderViewHost*> ViewSet; |
| 56 const ViewSet GetAllViews() const; | 56 const ViewSet GetAllViews() const; |
| 57 | 57 |
| 58 // The typical observer interface. | 58 // The typical observer interface. |
| 59 void AddObserver(ProcessManagerObserver* observer); | 59 void AddObserver(ProcessManagerObserver* observer); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 | 177 |
| 178 protected: | 178 protected: |
| 179 // If |context| is incognito pass the master context as |original_context|. | 179 // If |context| is incognito pass the master context as |original_context|. |
| 180 // Otherwise pass the same context for both. Pass the ExtensionRegistry for | 180 // Otherwise pass the same context for both. Pass the ExtensionRegistry for |
| 181 // |context| as |registry|, or override it for testing. | 181 // |context| as |registry|, or override it for testing. |
| 182 ProcessManager(content::BrowserContext* context, | 182 ProcessManager(content::BrowserContext* context, |
| 183 content::BrowserContext* original_context, | 183 content::BrowserContext* original_context, |
| 184 ExtensionRegistry* registry); | 184 ExtensionRegistry* registry); |
| 185 | 185 |
| 186 // content::NotificationObserver: | 186 // content::NotificationObserver: |
| 187 virtual void Observe(int type, | 187 void Observe(int type, |
| 188 const content::NotificationSource& source, | 188 const content::NotificationSource& source, |
| 189 const content::NotificationDetails& details) override; | 189 const content::NotificationDetails& details) override; |
| 190 | 190 |
| 191 content::NotificationRegistrar registrar_; | 191 content::NotificationRegistrar registrar_; |
| 192 | 192 |
| 193 // The set of ExtensionHosts running viewless background extensions. | 193 // The set of ExtensionHosts running viewless background extensions. |
| 194 ExtensionHostSet background_hosts_; | 194 ExtensionHostSet background_hosts_; |
| 195 | 195 |
| 196 // A SiteInstance related to the SiteInstance for all extensions in | 196 // A SiteInstance related to the SiteInstance for all extensions in |
| 197 // this profile. We create it in such a way that a new | 197 // this profile. We create it in such a way that a new |
| 198 // browsing instance is created. This controls process grouping. | 198 // browsing instance is created. This controls process grouping. |
| 199 scoped_refptr<content::SiteInstance> site_instance_; | 199 scoped_refptr<content::SiteInstance> site_instance_; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 285 |
| 286 // Must be last member, see doc on WeakPtrFactory. | 286 // Must be last member, see doc on WeakPtrFactory. |
| 287 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; | 287 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; |
| 288 | 288 |
| 289 DISALLOW_COPY_AND_ASSIGN(ProcessManager); | 289 DISALLOW_COPY_AND_ASSIGN(ProcessManager); |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 } // namespace extensions | 292 } // namespace extensions |
| 293 | 293 |
| 294 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ | 294 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ |
| OLD | NEW |