| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 void RegisterSchemaResource(const std::string& api_name, int resource_id); | 63 void RegisterSchemaResource(const std::string& api_name, int resource_id); |
| 64 | 64 |
| 65 void RegisterDependencyProvider(const std::string& name, | 65 void RegisterDependencyProvider(const std::string& name, |
| 66 FeatureProvider* provider); | 66 const FeatureProvider* provider); |
| 67 | 67 |
| 68 // Returns true if the API feature |api| and all of its dependencies are | 68 // Returns true if the API feature |api| and all of its dependencies are |
| 69 // available in |context|. | 69 // available in |context|. |
| 70 // | 70 // |
| 71 // Depending on the configuration of |api| (in _api_features.json), either | 71 // Depending on the configuration of |api| (in _api_features.json), either |
| 72 // |extension| or |url| (or both) may determine its availability, but this is | 72 // |extension| or |url| (or both) may determine its availability, but this is |
| 73 // up to the configuration of the individual feature. | 73 // up to the configuration of the individual feature. |
| 74 Feature::Availability IsAvailable(const Feature& api, | 74 Feature::Availability IsAvailable(const Feature& api, |
| 75 const Extension* extension, | 75 const Extension* extension, |
| 76 Feature::Context context, | 76 Feature::Context context, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // it. Note that there may be multiple APIs per schema. | 132 // it. Note that there may be multiple APIs per schema. |
| 133 typedef std::map<std::string, int> UnloadedSchemaMap; | 133 typedef std::map<std::string, int> UnloadedSchemaMap; |
| 134 UnloadedSchemaMap unloaded_schemas_; | 134 UnloadedSchemaMap unloaded_schemas_; |
| 135 | 135 |
| 136 // Schemas for each namespace. | 136 // Schemas for each namespace. |
| 137 typedef std::map<std::string, linked_ptr<const base::DictionaryValue> > | 137 typedef std::map<std::string, linked_ptr<const base::DictionaryValue> > |
| 138 SchemaMap; | 138 SchemaMap; |
| 139 SchemaMap schemas_; | 139 SchemaMap schemas_; |
| 140 | 140 |
| 141 // FeatureProviders used for resolving dependencies. | 141 // FeatureProviders used for resolving dependencies. |
| 142 typedef std::map<std::string, FeatureProvider*> FeatureProviderMap; | 142 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; |
| 143 FeatureProviderMap dependency_providers_; | 143 FeatureProviderMap dependency_providers_; |
| 144 | 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); | 145 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 } // namespace extensions | 148 } // namespace extensions |
| 149 | 149 |
| 150 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ | 150 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ |
| OLD | NEW |