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

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

Issue 443623002: Revert of Resubmit: Remove deprecated extension notifications from ProcessManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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; 36 class ExtensionRegistry;
39 class ProcessManagerDelegate; 37 class ProcessManagerDelegate;
40 class ProcessManagerObserver; 38 class ProcessManagerObserver;
41 39
42 // Manages dynamic state of running Chromium extensions. There is one instance 40 // Manages dynamic state of running Chromium extensions. There is one instance
43 // 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
44 // track of split-mode extensions only. 42 // track of split-mode extensions only.
45 class ProcessManager : public content::NotificationObserver, 43 class ProcessManager : public content::NotificationObserver {
46 public ExtensionRegistryObserver {
47 public: 44 public:
48 typedef std::set<extensions::ExtensionHost*> ExtensionHostSet; 45 typedef std::set<extensions::ExtensionHost*> ExtensionHostSet;
49 typedef ExtensionHostSet::const_iterator const_iterator; 46 typedef ExtensionHostSet::const_iterator const_iterator;
50 47
51 static ProcessManager* Create(content::BrowserContext* context); 48 static ProcessManager* Create(content::BrowserContext* context);
52 virtual ~ProcessManager(); 49 virtual ~ProcessManager();
53 50
54 const ExtensionHostSet& background_hosts() const { 51 const ExtensionHostSet& background_hosts() const {
55 return background_hosts_; 52 return background_hosts_;
56 } 53 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // |context| as |registry|, or override it for testing. 166 // |context| as |registry|, or override it for testing.
170 ProcessManager(content::BrowserContext* context, 167 ProcessManager(content::BrowserContext* context,
171 content::BrowserContext* original_context, 168 content::BrowserContext* original_context,
172 ExtensionRegistry* registry); 169 ExtensionRegistry* registry);
173 170
174 // content::NotificationObserver: 171 // content::NotificationObserver:
175 virtual void Observe(int type, 172 virtual void Observe(int type,
176 const content::NotificationSource& source, 173 const content::NotificationSource& source,
177 const content::NotificationDetails& details) OVERRIDE; 174 const content::NotificationDetails& details) OVERRIDE;
178 175
179 // ExtensionRegistryObserver:
180 virtual void OnExtensionLoaded(content::BrowserContext* browser_context,
181 const Extension* extension) OVERRIDE;
182 virtual void OnExtensionUnloaded(
183 content::BrowserContext* browser_context,
184 const Extension* extension,
185 UnloadedExtensionInfo::Reason reason) OVERRIDE;
186
187 content::NotificationRegistrar registrar_; 176 content::NotificationRegistrar registrar_;
188 177
189 // The set of ExtensionHosts running viewless background extensions. 178 // The set of ExtensionHosts running viewless background extensions.
190 ExtensionHostSet background_hosts_; 179 ExtensionHostSet background_hosts_;
191 180
192 // A SiteInstance related to the SiteInstance for all extensions in 181 // A SiteInstance related to the SiteInstance for all extensions in
193 // this profile. We create it in such a way that a new 182 // this profile. We create it in such a way that a new
194 // browsing instance is created. This controls process grouping. 183 // browsing instance is created. This controls process grouping.
195 scoped_refptr<content::SiteInstance> site_instance_; 184 scoped_refptr<content::SiteInstance> site_instance_;
196 185
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // value of the extension's close_sequence_id at the beginning of the process. 272 // value of the extension's close_sequence_id at the beginning of the process.
284 // Thus comparisons can be done to halt when IDs no longer match. 273 // Thus comparisons can be done to halt when IDs no longer match.
285 // 274 //
286 // This counter provides unique IDs even when BackgroundPageData objects are 275 // This counter provides unique IDs even when BackgroundPageData objects are
287 // reset. 276 // reset.
288 uint64 last_background_close_sequence_id_; 277 uint64 last_background_close_sequence_id_;
289 278
290 // Must be last member, see doc on WeakPtrFactory. 279 // Must be last member, see doc on WeakPtrFactory.
291 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_; 280 base::WeakPtrFactory<ProcessManager> weak_ptr_factory_;
292 281
293 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
294 extension_registry_observer_;
295
296 DISALLOW_COPY_AND_ASSIGN(ProcessManager); 282 DISALLOW_COPY_AND_ASSIGN(ProcessManager);
297 }; 283 };
298 284
299 } // namespace extensions 285 } // namespace extensions
300 286
301 #endif // EXTENSIONS_BROWSER_PROCESS_MANAGER_H_ 287 #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