Chromium Code Reviews| 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|. Called by the browser process when | |
|
Devlin
2016/08/19 15:02:32
nit: omit "called by the browser process...". Tha
Wez
2016/08/19 18:22:15
Done.
| |
| 115 // it is notified that the schema may be corrupted. If the schema cannot be | |
| 116 // loaded then the calling process will be killed. If the |api| is not | |
| 117 // recognized then the call has no effect. | |
| 118 void LoadSchemaListOrDie(const std::string& api); | |
| 119 | |
| 113 // Splits a full name from the extension API into its API and child name | 120 // Splits a full name from the extension API into its API and child name |
| 114 // parts. Some examples: | 121 // parts. Some examples: |
| 115 // | 122 // |
| 116 // "bookmarks.create" -> ("bookmarks", "create") | 123 // "bookmarks.create" -> ("bookmarks", "create") |
| 117 // "experimental.input.ui.cursorUp" -> ("experimental.input.ui", "cursorUp") | 124 // "experimental.input.ui.cursorUp" -> ("experimental.input.ui", "cursorUp") |
| 118 // "storage.sync.set" -> ("storage", "sync.get") | 125 // "storage.sync.set" -> ("storage", "sync.get") |
| 119 // "<unknown-api>.monkey" -> ("", "") | 126 // "<unknown-api>.monkey" -> ("", "") |
| 120 // | 127 // |
| 121 // The |child_name| parameter can be be NULL if you don't need that part. | 128 // The |child_name| parameter can be be NULL if you don't need that part. |
| 122 std::string GetAPINameFromFullName(const std::string& full_name, | 129 std::string GetAPINameFromFullName(const std::string& full_name, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 151 // FeatureProviders used for resolving dependencies. | 158 // FeatureProviders used for resolving dependencies. |
| 152 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; | 159 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; |
| 153 FeatureProviderMap dependency_providers_; | 160 FeatureProviderMap dependency_providers_; |
| 154 | 161 |
| 155 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); | 162 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); |
| 156 }; | 163 }; |
| 157 | 164 |
| 158 } // namespace extensions | 165 } // namespace extensions |
| 159 | 166 |
| 160 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ | 167 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ |
| OLD | NEW |