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_COMMON_EXTENSION_API_H_ | 5 #ifndef EXTENSIONS_COMMON_EXTENSION_API_H_ |
6 #define EXTENSIONS_COMMON_EXTENSION_API_H_ | 6 #define EXTENSIONS_COMMON_EXTENSION_API_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 Feature::Context context, | 97 Feature::Context context, |
98 const GURL& url); | 98 const GURL& url); |
99 | 99 |
100 // Determines whether an API, or any parts of that API, are available in | 100 // Determines whether an API, or any parts of that API, are available in |
101 // |context|. | 101 // |context|. |
102 bool IsAnyFeatureAvailableToContext(const Feature& api, | 102 bool IsAnyFeatureAvailableToContext(const Feature& api, |
103 const Extension* extension, | 103 const Extension* extension, |
104 Feature::Context context, | 104 Feature::Context context, |
105 const GURL& url); | 105 const GURL& url); |
106 | 106 |
107 // Returns true if |name| is a privileged API path. Privileged paths can only | 107 // Returns true if |name| is available to |extension| in any untrusted |
108 // be called from extension code which is running in its own designated | 108 // extension context, such as content scripts, iframes, or web pages. |
109 // extension process. They cannot be called from extension code running in | 109 bool IsAvailableInUntrustedContext(const std::string& name, |
110 // content scripts, or other low-privileged contexts. | 110 const Extension* extension); |
111 bool IsPrivileged(const std::string& name); | |
112 | 111 |
113 // Gets the schema for the extension API with namespace |full_name|. | 112 // Gets the schema for the extension API with namespace |full_name|. |
114 // Ownership remains with this object. | 113 // Ownership remains with this object. |
115 const base::DictionaryValue* GetSchema(const std::string& full_name); | 114 const base::DictionaryValue* GetSchema(const std::string& full_name); |
116 | 115 |
117 // Splits a full name from the extension API into its API and child name | 116 // Splits a full name from the extension API into its API and child name |
118 // parts. Some examples: | 117 // parts. Some examples: |
119 // | 118 // |
120 // "bookmarks.create" -> ("bookmarks", "create") | 119 // "bookmarks.create" -> ("bookmarks", "create") |
121 // "experimental.input.ui.cursorUp" -> ("experimental.input.ui", "cursorUp") | 120 // "experimental.input.ui.cursorUp" -> ("experimental.input.ui", "cursorUp") |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // FeatureProviders used for resolving dependencies. | 154 // FeatureProviders used for resolving dependencies. |
156 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; | 155 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; |
157 FeatureProviderMap dependency_providers_; | 156 FeatureProviderMap dependency_providers_; |
158 | 157 |
159 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); | 158 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); |
160 }; | 159 }; |
161 | 160 |
162 } // namespace extensions | 161 } // namespace extensions |
163 | 162 |
164 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ | 163 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ |
OLD | NEW |