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_INFO_MAP_H_ | 5 #ifndef EXTENSIONS_BROWSER_INFO_MAP_H_ |
6 #define EXTENSIONS_BROWSER_INFO_MAP_H_ | 6 #define EXTENSIONS_BROWSER_INFO_MAP_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "extensions/browser/process_map.h" | 14 #include "extensions/browser/process_map.h" |
15 #include "extensions/browser/quota_service.h" | 15 #include "extensions/browser/quota_service.h" |
16 #include "extensions/common/extension_set.h" | 16 #include "extensions/common/extension_set.h" |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
| 19 class ContentVerifier; |
19 class Extension; | 20 class Extension; |
20 | 21 |
21 // Contains extension data that needs to be accessed on the IO thread. It can | 22 // Contains extension data that needs to be accessed on the IO thread. It can |
22 // be created/destroyed on any thread, but all other methods must be called on | 23 // be created/destroyed on any thread, but all other methods must be called on |
23 // the IO thread. | 24 // the IO thread. |
24 class InfoMap : public base::RefCountedThreadSafe<InfoMap> { | 25 class InfoMap : public base::RefCountedThreadSafe<InfoMap> { |
25 public: | 26 public: |
26 InfoMap(); | 27 InfoMap(); |
27 | 28 |
28 const ExtensionSet& extensions() const { return extensions_; } | 29 const ExtensionSet& extensions() const { return extensions_; } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // Keep track of the signin process, so we can restrict extension access to | 97 // Keep track of the signin process, so we can restrict extension access to |
97 // it. | 98 // it. |
98 void SetSigninProcess(int process_id); | 99 void SetSigninProcess(int process_id); |
99 bool IsSigninProcess(int process_id) const; | 100 bool IsSigninProcess(int process_id) const; |
100 | 101 |
101 // Notifications can be enabled/disabled in real time by the user. | 102 // Notifications can be enabled/disabled in real time by the user. |
102 void SetNotificationsDisabled(const std::string& extension_id, | 103 void SetNotificationsDisabled(const std::string& extension_id, |
103 bool notifications_disabled); | 104 bool notifications_disabled); |
104 bool AreNotificationsDisabled(const std::string& extension_id) const; | 105 bool AreNotificationsDisabled(const std::string& extension_id) const; |
105 | 106 |
| 107 void SetContentVerifier(ContentVerifier* verifier); |
| 108 ContentVerifier* content_verifier() { return content_verifier_; } |
| 109 |
106 private: | 110 private: |
107 friend class base::RefCountedThreadSafe<InfoMap>; | 111 friend class base::RefCountedThreadSafe<InfoMap>; |
108 | 112 |
109 // Extra dynamic data related to an extension. | 113 // Extra dynamic data related to an extension. |
110 struct ExtraData; | 114 struct ExtraData; |
111 // Map of extension_id to ExtraData. | 115 // Map of extension_id to ExtraData. |
112 typedef std::map<std::string, ExtraData> ExtraDataMap; | 116 typedef std::map<std::string, ExtraData> ExtraDataMap; |
113 | 117 |
114 ~InfoMap(); | 118 ~InfoMap(); |
115 | 119 |
116 ExtensionSet extensions_; | 120 ExtensionSet extensions_; |
117 ExtensionSet disabled_extensions_; | 121 ExtensionSet disabled_extensions_; |
118 | 122 |
119 // Extra data associated with enabled extensions. | 123 // Extra data associated with enabled extensions. |
120 ExtraDataMap extra_data_; | 124 ExtraDataMap extra_data_; |
121 | 125 |
122 // Used by dispatchers to limit API quota for individual extensions. | 126 // Used by dispatchers to limit API quota for individual extensions. |
123 // The QuotaService is not thread safe. We need to create and destroy it on | 127 // The QuotaService is not thread safe. We need to create and destroy it on |
124 // the IO thread. | 128 // the IO thread. |
125 scoped_ptr<QuotaService> quota_service_; | 129 scoped_ptr<QuotaService> quota_service_; |
126 | 130 |
127 // Assignment of extensions to renderer processes. | 131 // Assignment of extensions to renderer processes. |
128 extensions::ProcessMap process_map_; | 132 extensions::ProcessMap process_map_; |
129 | 133 |
130 // Assignment of extensions to worker processes. | 134 // Assignment of extensions to worker processes. |
131 extensions::ProcessMap worker_process_map_; | 135 extensions::ProcessMap worker_process_map_; |
132 | 136 |
133 int signin_process_id_; | 137 int signin_process_id_; |
| 138 |
| 139 scoped_refptr<ContentVerifier> content_verifier_; |
134 }; | 140 }; |
135 | 141 |
136 } // namespace extensions | 142 } // namespace extensions |
137 | 143 |
138 #endif // EXTENSIONS_BROWSER_INFO_MAP_H_ | 144 #endif // EXTENSIONS_BROWSER_INFO_MAP_H_ |
OLD | NEW |