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

Side by Side Diff: chrome/common/extensions/api/extension_api.h

Issue 12313142: Revert 184837 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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
« no previous file with comments | « chrome/chrome_renderer.gypi ('k') | chrome/common/extensions/api/extension_api.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_COMMON_EXTENSIONS_API_EXTENSION_API_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_API_EXTENSION_API_H_
6 #define CHROME_COMMON_EXTENSIONS_API_EXTENSION_API_H_ 6 #define CHROME_COMMON_EXTENSIONS_API_EXTENSION_API_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // content scripts, or other low-privileged contexts. 81 // content scripts, or other low-privileged contexts.
82 bool IsPrivileged(const std::string& name); 82 bool IsPrivileged(const std::string& name);
83 83
84 // Gets the schema for the extension API with namespace |full_name|. 84 // Gets the schema for the extension API with namespace |full_name|.
85 // Ownership remains with this object. 85 // Ownership remains with this object.
86 const base::DictionaryValue* GetSchema(const std::string& full_name); 86 const base::DictionaryValue* GetSchema(const std::string& full_name);
87 87
88 // Gets the APIs available to |context| given an |extension| and |url|. The 88 // Gets the APIs available to |context| given an |extension| and |url|. The
89 // extension or URL may not be relevant to all contexts, and may be left 89 // extension or URL may not be relevant to all contexts, and may be left
90 // NULL/empty. 90 // NULL/empty.
91 std::set<std::string> GetAPIsForContext( 91 scoped_ptr<std::set<std::string> > GetAPIsForContext(
92 Feature::Context context, const Extension* extension, const GURL& url); 92 Feature::Context context, const Extension* extension, const GURL& url);
93 93
94 std::set<std::string> GetAllAPINames();
95
96 // Gets a Feature object describing the API with the specified |full_name|. 94 // Gets a Feature object describing the API with the specified |full_name|.
97 // This can be either an API namespace (like history, or 95 // This can be either an API namespace (like history, or
98 // experimental.bookmarks), or it can be an individual function or event. 96 // experimental.bookmarks), or it can be an individual function or event.
99 virtual Feature* GetFeature(const std::string& full_name) OVERRIDE; 97 virtual Feature* GetFeature(const std::string& full_name) OVERRIDE;
100 98
101 // Splits a full name from the extension API into its API and child name 99 // Splits a full name from the extension API into its API and child name
102 // parts. Some examples: 100 // parts. Some examples:
103 // 101 //
104 // "bookmarks.create" -> ("bookmarks", "create") 102 // "bookmarks.create" -> ("bookmarks", "create")
105 // "experimental.input.ui.cursorUp" -> ("experimental.input.ui", "cursorUp") 103 // "experimental.input.ui.cursorUp" -> ("experimental.input.ui", "cursorUp")
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // "extension" which has unprivileged components. 151 // "extension" which has unprivileged components.
154 void RemovePrivilegedAPIs(std::set<std::string>* apis); 152 void RemovePrivilegedAPIs(std::set<std::string>* apis);
155 153
156 // Adds an APIs that match |url| to |out|. 154 // Adds an APIs that match |url| to |out|.
157 // NOTE: This only works for non-feature-controlled APIs. 155 // NOTE: This only works for non-feature-controlled APIs.
158 // TODO(aa): Remove this when all APIs are converted to the feature system. 156 // TODO(aa): Remove this when all APIs are converted to the feature system.
159 void GetAPIsMatchingURL(const GURL& url, std::set<std::string>* out); 157 void GetAPIsMatchingURL(const GURL& url, std::set<std::string>* out);
160 158
161 // Map from each API that hasn't been loaded yet to the schema which defines 159 // Map from each API that hasn't been loaded yet to the schema which defines
162 // it. Note that there may be multiple APIs per schema. 160 // it. Note that there may be multiple APIs per schema.
163 typedef std::map<std::string, base::StringPiece> UnloadedSchemaMap; 161 std::map<std::string, base::StringPiece> unloaded_schemas_;
164 UnloadedSchemaMap unloaded_schemas_;
165 162
166 // Schemas for each namespace. 163 // Schemas for each namespace.
167 typedef std::map<std::string, linked_ptr<const DictionaryValue> > SchemaMap; 164 typedef std::map<std::string, linked_ptr<const DictionaryValue> > SchemaMap;
168 SchemaMap schemas_; 165 SchemaMap schemas_;
169 166
170 // APIs that are entirely unprivileged. 167 // APIs that are entirely unprivileged.
171 std::set<std::string> completely_unprivileged_apis_; 168 std::set<std::string> completely_unprivileged_apis_;
172 169
173 // APIs that are not entirely unprivileged, but have unprivileged components. 170 // APIs that are not entirely unprivileged, but have unprivileged components.
174 std::set<std::string> partially_unprivileged_apis_; 171 std::set<std::string> partially_unprivileged_apis_;
175 172
176 // APIs that have URL matching permissions. 173 // APIs that have URL matching permissions.
177 std::map<std::string, URLPatternSet> url_matching_apis_; 174 std::map<std::string, URLPatternSet> url_matching_apis_;
178 175
179 typedef std::map<std::string, linked_ptr<Feature> > FeatureMap; 176 typedef std::map<std::string, linked_ptr<Feature> > FeatureMap;
180 typedef std::map<std::string, linked_ptr<FeatureMap> > APIFeatureMap; 177 typedef std::map<std::string, linked_ptr<FeatureMap> > APIFeatureMap;
181 APIFeatureMap features_; 178 APIFeatureMap features_;
182 179
183 // FeatureProviders used for resolving dependencies. 180 // FeatureProviders used for resolving dependencies.
184 typedef std::map<std::string, FeatureProvider*> FeatureProviderMap; 181 typedef std::map<std::string, FeatureProvider*> FeatureProviderMap;
185 FeatureProviderMap dependency_providers_; 182 FeatureProviderMap dependency_providers_;
186 183
187 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); 184 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI);
188 }; 185 };
189 186
190 } // extensions 187 } // extensions
191 188
192 #endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_API_H_ 189 #endif // CHROME_COMMON_EXTENSIONS_API_EXTENSION_API_H_
OLDNEW
« no previous file with comments | « chrome/chrome_renderer.gypi ('k') | chrome/common/extensions/api/extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698