| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 // "permission", or "api". The second part is the full name of the feature. | 53 // "permission", or "api". The second part is the full name of the feature. |
| 54 static void SplitDependencyName(const std::string& full_name, | 54 static void SplitDependencyName(const std::string& full_name, |
| 55 std::string* feature_type, | 55 std::string* feature_type, |
| 56 std::string* feature_name); | 56 std::string* feature_name); |
| 57 | 57 |
| 58 // Creates a completely clean instance. Configure using RegisterSchema() and | 58 // Creates a completely clean instance. Configure using RegisterSchema() and |
| 59 // RegisterDependencyProvider before use. | 59 // RegisterDependencyProvider before use. |
| 60 ExtensionAPI(); | 60 ExtensionAPI(); |
| 61 virtual ~ExtensionAPI(); | 61 virtual ~ExtensionAPI(); |
| 62 | 62 |
| 63 // Add a (non-generated) API schema resource. |
| 63 void RegisterSchemaResource(const std::string& api_name, int resource_id); | 64 void RegisterSchemaResource(const std::string& api_name, int resource_id); |
| 64 | 65 |
| 66 // Add a FeatureProvider for APIs. The features are used to specify |
| 67 // dependencies and constraints on the availability of APIs. |
| 65 void RegisterDependencyProvider(const std::string& name, | 68 void RegisterDependencyProvider(const std::string& name, |
| 66 const FeatureProvider* provider); | 69 const FeatureProvider* provider); |
| 67 | 70 |
| 68 // Returns true if the API feature |api| and all of its dependencies are | 71 // Returns true if the API feature |api| and all of its dependencies are |
| 69 // available in |context|. | 72 // available in |context|. |
| 70 // | 73 // |
| 71 // Depending on the configuration of |api| (in _api_features.json), either | 74 // Depending on the configuration of |api| (in _api_features.json), either |
| 72 // |extension| or |url| (or both) may determine its availability, but this is | 75 // |extension| or |url| (or both) may determine its availability, but this is |
| 73 // up to the configuration of the individual feature. | 76 // up to the configuration of the individual feature. |
| 74 Feature::Availability IsAvailable(const Feature& api, | 77 Feature::Availability IsAvailable(const Feature& api, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // FeatureProviders used for resolving dependencies. | 144 // FeatureProviders used for resolving dependencies. |
| 142 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; | 145 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; |
| 143 FeatureProviderMap dependency_providers_; | 146 FeatureProviderMap dependency_providers_; |
| 144 | 147 |
| 145 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); | 148 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); |
| 146 }; | 149 }; |
| 147 | 150 |
| 148 } // namespace extensions | 151 } // namespace extensions |
| 149 | 152 |
| 150 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ | 153 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ |
| OLD | NEW |