Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: extensions/browser/process_manager.h

Issue 407883003: Revert of Remove deprecated extension notifications from ProcessManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | extensions/browser/process_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/scoped_observer.h"
18 #include "base/time/time.h" 17 #include "base/time/time.h"
19 #include "content/public/browser/notification_observer.h" 18 #include "content/public/browser/notification_observer.h"
20 #include "content/public/browser/notification_registrar.h" 19 #include "content/public/browser/notification_registrar.h"
21 #include "extensions/browser/extension_registry_observer.h"
22 #include "extensions/common/view_type.h" 20 #include "extensions/common/view_type.h"
23 21
24 class GURL; 22 class GURL;
25 23
26 namespace content { 24 namespace content {
27 class BrowserContext; 25 class BrowserContext;
28 class DevToolsAgentHost; 26 class DevToolsAgentHost;
29 class RenderViewHost; 27 class RenderViewHost;
30 class RenderFrameHost; 28 class RenderFrameHost;
31 class SiteInstance; 29 class SiteInstance;
32 }; 30 };
33 31
34 namespace extensions { 32 namespace extensions {
35 33
36 class Extension; 34 class Extension;
37 class ExtensionHost; 35 class ExtensionHost;
38 class ExtensionRegistry;
39 class ProcessManagerObserver; 36 class ProcessManagerObserver;
40 37
41 // Manages dynamic state of running Chromium extensions. There is one instance 38 // 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 39 // of this class per Profile. OTR Profiles have a separate instance that keeps
43 // track of split-mode extensions only. 40 // track of split-mode extensions only.
44 class ProcessManager : public content::NotificationObserver, 41 class ProcessManager : public content::NotificationObserver {
45 public ExtensionRegistryObserver {
46 public: 42 public:
47 typedef std::set<extensions::ExtensionHost*> ExtensionHostSet; 43 typedef std::set<extensions::ExtensionHost*> ExtensionHostSet;
48 typedef ExtensionHostSet::const_iterator const_iterator; 44 typedef ExtensionHostSet::const_iterator const_iterator;
49 45
50 static ProcessManager* Create(content::BrowserContext* context); 46 static ProcessManager* Create(content::BrowserContext* context);
51 virtual ~ProcessManager(); 47 virtual ~ProcessManager();
52 48
53 const ExtensionHostSet& background_hosts() const { 49 const ExtensionHostSet& background_hosts() const {
54 return background_hosts_; 50 return background_hosts_;
55 } 51 }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 content::BrowserContext* original_context); 151 content::BrowserContext* original_context);
156 152
157 // Called on browser shutdown to close our extension hosts. 153 // Called on browser shutdown to close our extension hosts.
158 void CloseBackgroundHosts(); 154 void CloseBackgroundHosts();
159 155
160 // content::NotificationObserver: 156 // content::NotificationObserver:
161 virtual void Observe(int type, 157 virtual void Observe(int type,
162 const content::NotificationSource& source, 158 const content::NotificationSource& source,
163 const content::NotificationDetails& details) OVERRIDE; 159 const content::NotificationDetails& details) OVERRIDE;
164 160
165 // ExtensionRegistryObserver:
166 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
167 const Extension* extension) OVERRIDE;
168 virtual void OnExtensionUnloaded(
169 content::BrowserContext* browser_context,
170 const Extension* extension,
171 UnloadedExtensionInfo::Reason reason) OVERRIDE;
172
173 // Load all background pages once the profile data is ready and the pages 161 // Load all background pages once the profile data is ready and the pages
174 // should be loaded. 162 // should be loaded.
175 void CreateBackgroundHostsForProfileStartup(); 163 void CreateBackgroundHostsForProfileStartup();
176 164
177 content::NotificationRegistrar registrar_; 165 content::NotificationRegistrar registrar_;
178 166
179 // The set of ExtensionHosts running viewless background extensions. 167 // The set of ExtensionHosts running viewless background extensions.
180 ExtensionHostSet background_hosts_; 168 ExtensionHostSet background_hosts_;
181 169
182 // A SiteInstance related to the SiteInstance for all extensions in 170 // A SiteInstance related to the SiteInstance for all extensions in
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // value of the extension's close_sequence_id at the beginning of the process. 257 // value of the extension's close_sequence_id at the beginning of the process.
270 // Thus comparisons can be done to halt when IDs no longer match. 258 // Thus comparisons can be done to halt when IDs no longer match.
271 // 259 //
272 // This counter provides unique IDs even when BackgroundPageData objects are 260 // This counter provides unique IDs even when BackgroundPageData objects are
273 // reset. 261 // reset.
274 uint64 last_background_close_sequence_id_; 262 uint64 last_background_close_sequence_id_;
275 263
276 // Must be last member, see doc on WeakPtrFactory. 264 // Must be last member, see doc on WeakPtrFactory.
277 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; 265 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_;
278 266
279 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
280 extension_registry_observer_;
281
282 DISALLOW_COPY_AND_ASSIGN(ProcessManager); 267 DISALLOW_COPY_AND_ASSIGN(ProcessManager);
283 }; 268 };
284 269
285 } // namespace extensions 270 } // namespace extensions
286 271
287 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ 272 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/browser/process_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698