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 <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Determines whether an API, or any parts of that API, are available in | 99 // Determines whether an API, or any parts of that API, are available in |
100 // |context|. | 100 // |context|. |
101 bool IsAnyFeatureAvailableToContext(const Feature& api, | 101 bool IsAnyFeatureAvailableToContext(const Feature& api, |
102 const Extension* extension, | 102 const Extension* extension, |
103 Feature::Context context, | 103 Feature::Context context, |
104 const GURL& url); | 104 const GURL& url); |
105 | 105 |
106 // Returns true if |name| is available to WebUI contexts on |url|. | 106 // Returns true if |name| is available to WebUI contexts on |url|. |
107 bool IsAvailableToWebUI(const std::string& name, const GURL& url); | 107 bool IsAvailableToWebUI(const std::string& name, const GURL& url); |
108 | 108 |
109 // Gets the schema for the extension API with namespace |full_name|. | 109 // Gets the schema for the extension API with namespace |full_name|, or |
| 110 // nullptr if the schema could not be loaded. |
110 // Ownership remains with this object. | 111 // Ownership remains with this object. |
111 const base::DictionaryValue* GetSchema(const std::string& full_name); | 112 const base::DictionaryValue* GetSchema(const std::string& full_name); |
112 | 113 |
| 114 // Attempts to load the schema for |api|. If the schema cannot be |
| 115 // loaded then the calling process will be killed. If the |api| is not |
| 116 // recognized then the call has no effect. |
| 117 void LoadSchemaListOrDie(const std::string& api); |
| 118 |
113 // Splits a full name from the extension API into its API and child name | 119 // Splits a full name from the extension API into its API and child name |
114 // parts. Some examples: | 120 // parts. Some examples: |
115 // | 121 // |
116 // "bookmarks.create" -> ("bookmarks", "create") | 122 // "bookmarks.create" -> ("bookmarks", "create") |
117 // "experimental.input.ui.cursorUp" -> ("experimental.input.ui", "cursorUp") | 123 // "experimental.input.ui.cursorUp" -> ("experimental.input.ui", "cursorUp") |
118 // "storage.sync.set" -> ("storage", "sync.get") | 124 // "storage.sync.set" -> ("storage", "sync.get") |
119 // "<unknown-api>.monkey" -> ("", "") | 125 // "<unknown-api>.monkey" -> ("", "") |
120 // | 126 // |
121 // The |child_name| parameter can be be NULL if you don't need that part. | 127 // The |child_name| parameter can be be NULL if you don't need that part. |
122 std::string GetAPINameFromFullName(const std::string& full_name, | 128 std::string GetAPINameFromFullName(const std::string& full_name, |
(...skipping 28 matching lines...) Expand all Loading... |
151 // FeatureProviders used for resolving dependencies. | 157 // FeatureProviders used for resolving dependencies. |
152 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; | 158 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; |
153 FeatureProviderMap dependency_providers_; | 159 FeatureProviderMap dependency_providers_; |
154 | 160 |
155 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); | 161 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); |
156 }; | 162 }; |
157 | 163 |
158 } // namespace extensions | 164 } // namespace extensions |
159 | 165 |
160 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ | 166 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ |
OLD | NEW |