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: chrome/browser/extensions/extension_info_map.h

Issue 8361021: Track all extension processes in ExtensionInfoMap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: maybe fix dcheck Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_INFO_MAP_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_
7 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "chrome/common/extensions/extension_constants.h" 15 #include "chrome/common/extensions/extension_constants.h"
16 #include "chrome/common/extensions/extension_set.h" 16 #include "chrome/common/extensions/extension_set.h"
17 17
18 class Extension; 18 class Extension;
19 19
(...skipping 23 matching lines...) Expand all
43 base::Time GetInstallTime(const std::string& extension_id) const; 43 base::Time GetInstallTime(const std::string& extension_id) const;
44 44
45 // Returns true if the user has allowed this extension to run in incognito 45 // Returns true if the user has allowed this extension to run in incognito
46 // mode. 46 // mode.
47 bool IsIncognitoEnabled(const std::string& extension_id) const; 47 bool IsIncognitoEnabled(const std::string& extension_id) const;
48 48
49 // Returns true if the given extension can see events and data from another 49 // Returns true if the given extension can see events and data from another
50 // sub-profile (incognito to original profile, or vice versa). 50 // sub-profile (incognito to original profile, or vice versa).
51 bool CanCrossIncognito(const Extension* extension); 51 bool CanCrossIncognito(const Extension* extension);
52 52
53 // Registers a RenderProcessHost with |render_process_id| as hosting an 53 // Record that |extension_id| is running in |process_id|. We normally have
54 // extension. 54 // this information in ExtensionProcessManager on the UI thread, but we also
55 void BindingsEnabledForProcess(int render_process_id); 55 // sometimes need it on the IO thread. Note that this can be any of
56 // (extension, packaged app, hosted app).
57 void RegisterExtensionProcess(const std::string& extension_id,
58 int process_id);
56 59
57 // Unregisters the RenderProcessHost with |render_process_id|. 60 // Remove any record of |extension_id| created with RegisterExtensionProcess.
58 void BindingsDisabledForProcess(int render_process_id); 61 // If |extension_id| is unknown, we ignore it.
62 void UnregisterExtensionProcess(const std::string& extension_id,
63 int process_id);
59 64
60 // True if this process host is hosting an extension with extension bindings. 65 // Returns the process id that |extension_id| is running in, or -1 if there is
61 bool AreBindingsEnabledForProcess(int render_process_id) const; 66 // no such extension.
67 int IsExtensionInProcess(const std::string& extension_id,
Matt Perry 2011/10/21 18:28:51 return bool and update the comment
Aaron Boodman 2011/10/22 04:02:42 Done.
68 int process_id) const;
62 69
63 private: 70 private:
64 // Extra dynamic data related to an extension. 71 // Extra dynamic data related to an extension.
65 struct ExtraData; 72 struct ExtraData;
66 // Map of extension_id to ExtraData. 73 // Map of extension_id to ExtraData.
67 typedef std::map<std::string, ExtraData> ExtraDataMap; 74 typedef std::map<std::string, ExtraData> ExtraDataMap;
68 75
69 ExtensionSet extensions_; 76 ExtensionSet extensions_;
70 ExtensionSet disabled_extensions_; 77 ExtensionSet disabled_extensions_;
71 78
72 // Extra data associated with enabled extensions. 79 // Extra data associated with enabled extensions.
73 ExtraDataMap extra_data_; 80 ExtraDataMap extra_data_;
74 81
75 // The set of process ids that have extension bindings enabled. 82 typedef std::multimap<std::string, int> ExtensionProcessIDMap;
76 std::set<int> extension_bindings_process_ids_; 83 ExtensionProcessIDMap extension_process_ids_;
77 }; 84 };
78 85
79 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_ 86 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_INFO_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698