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

Side by Side Diff: chrome/browser/extensions/extension_process_manager.h

Issue 155514: Implement extension specific events (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <set> 9 #include <set>
10 #include <string>
9 11
10 #include "base/ref_counted.h" 12 #include "base/ref_counted.h"
11 #include "chrome/common/notification_registrar.h" 13 #include "chrome/common/notification_registrar.h"
12 14
13 class Browser; 15 class Browser;
14 class BrowsingInstance; 16 class BrowsingInstance;
15 class Extension; 17 class Extension;
16 class ExtensionHost; 18 class ExtensionHost;
17 #if defined(TOOLKIT_VIEWS) 19 #if defined(TOOLKIT_VIEWS)
18 class ExtensionView; 20 class ExtensionView;
(...skipping 17 matching lines...) Expand all
36 Browser* browser); 38 Browser* browser);
37 ExtensionHost* CreateView(const GURL& url, Browser* browser); 39 ExtensionHost* CreateView(const GURL& url, Browser* browser);
38 40
39 // Creates a new UI-less extension instance. Like CreateView, but not 41 // Creates a new UI-less extension instance. Like CreateView, but not
40 // displayed anywhere. 42 // displayed anywhere.
41 ExtensionHost* CreateBackgroundHost(Extension* extension, const GURL& url); 43 ExtensionHost* CreateBackgroundHost(Extension* extension, const GURL& url);
42 44
43 // Returns the SiteInstance that the given URL belongs to. 45 // Returns the SiteInstance that the given URL belongs to.
44 SiteInstance* GetSiteInstanceForURL(const GURL& url); 46 SiteInstance* GetSiteInstanceForURL(const GURL& url);
45 47
48 // Register an extension process by |extension_id| and specifying which
49 // |process_id| it belongs to.
50 void RegisterExtensionProcess(std::string extension_id, int process_id);
51
52 // Unregister an extension process with specified |process_id|.
53 void UnregisterExtensionProcess(int process_id);
54
46 // NotificationObserver: 55 // NotificationObserver:
47 virtual void Observe(NotificationType type, 56 virtual void Observe(NotificationType type,
48 const NotificationSource& source, 57 const NotificationSource& source,
49 const NotificationDetails& details); 58 const NotificationDetails& details);
50 59
51 typedef std::set<ExtensionHost*> ExtensionHostSet; 60 typedef std::set<ExtensionHost*> ExtensionHostSet;
52 typedef ExtensionHostSet::const_iterator const_iterator; 61 typedef ExtensionHostSet::const_iterator const_iterator;
53 const_iterator begin() const { return all_hosts_.begin(); } 62 const_iterator begin() const { return all_hosts_.begin(); }
54 const_iterator end() const { return all_hosts_.end(); } 63 const_iterator end() const { return all_hosts_.end(); }
55 64
56 private: 65 private:
57 // Called just after |host| is created so it can be registered in our lists. 66 // Called just after |host| is created so it can be registered in our lists.
58 void OnExtensionHostCreated(ExtensionHost* host, bool is_background); 67 void OnExtensionHostCreated(ExtensionHost* host, bool is_background);
59 68
60 NotificationRegistrar registrar_; 69 NotificationRegistrar registrar_;
61 70
62 // The set of all ExtensionHosts managed by this process manager. 71 // The set of all ExtensionHosts managed by this process manager.
63 ExtensionHostSet all_hosts_; 72 ExtensionHostSet all_hosts_;
64 73
65 // The set of running viewless background extensions. 74 // The set of running viewless background extensions.
66 ExtensionHostSet background_hosts_; 75 ExtensionHostSet background_hosts_;
67 76
68 // The BrowsingInstance shared by all extensions in this profile. This 77 // The BrowsingInstance shared by all extensions in this profile. This
69 // controls process grouping. 78 // controls process grouping.
70 scoped_refptr<BrowsingInstance> browsing_instance_; 79 scoped_refptr<BrowsingInstance> browsing_instance_;
71 80
81 // A map of extension ID to the render_process_id that the extension lives in.
82 typedef std::map<std::string, int> ProcessIDMap;
83 ProcessIDMap process_ids_;
84
72 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager); 85 DISALLOW_COPY_AND_ASSIGN(ExtensionProcessManager);
73 }; 86 };
74 87
75 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_ 88 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROCESS_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698