| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // The |child_name| parameter can be be NULL if you don't need that part. | 120 // The |child_name| parameter can be be NULL if you don't need that part. |
| 121 std::string GetAPINameFromFullName(const std::string& full_name, | 121 std::string GetAPINameFromFullName(const std::string& full_name, |
| 122 std::string* child_name); | 122 std::string* child_name); |
| 123 | 123 |
| 124 // Gets a feature from any dependency provider registered with ExtensionAPI. | 124 // Gets a feature from any dependency provider registered with ExtensionAPI. |
| 125 // Returns NULL if the feature could not be found. | 125 // Returns NULL if the feature could not be found. |
| 126 Feature* GetFeatureDependency(const std::string& dependency_name); | 126 Feature* GetFeatureDependency(const std::string& dependency_name); |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 FRIEND_TEST_ALL_PREFIXES(ExtensionAPITest, DefaultConfigurationFeatures); | 129 FRIEND_TEST_ALL_PREFIXES(ExtensionAPITest, DefaultConfigurationFeatures); |
| 130 FRIEND_TEST_ALL_PREFIXES(ExtensionAPITest, TypesHaveNamespace); | |
| 131 friend struct base::DefaultSingletonTraits<ExtensionAPI>; | 130 friend struct base::DefaultSingletonTraits<ExtensionAPI>; |
| 132 | 131 |
| 133 void InitDefaultConfiguration(); | 132 void InitDefaultConfiguration(); |
| 134 | 133 |
| 135 // Returns true if there exists an API with |name|. Declared virtual for | 134 // Returns true if there exists an API with |name|. Declared virtual for |
| 136 // testing purposes. | 135 // testing purposes. |
| 137 virtual bool IsKnownAPI(const std::string& name, ExtensionsClient* client); | 136 virtual bool IsKnownAPI(const std::string& name, ExtensionsClient* client); |
| 138 | 137 |
| 139 bool default_configuration_initialized_; | 138 bool default_configuration_initialized_; |
| 140 | 139 |
| 141 // Loads a schema. | 140 // Loads a schema. |
| 142 void LoadSchema(const std::string& name, const base::StringPiece& schema); | 141 void LoadSchema(const std::string& name, const base::StringPiece& schema); |
| 143 | 142 |
| 144 // Schemas for each namespace. | 143 // Schemas for each namespace. |
| 145 using SchemaMap = | 144 using SchemaMap = |
| 146 std::map<std::string, std::unique_ptr<const base::DictionaryValue>>; | 145 std::map<std::string, std::unique_ptr<const base::DictionaryValue>>; |
| 147 SchemaMap schemas_; | 146 SchemaMap schemas_; |
| 148 | 147 |
| 149 // FeatureProviders used for resolving dependencies. | 148 // FeatureProviders used for resolving dependencies. |
| 150 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; | 149 typedef std::map<std::string, const FeatureProvider*> FeatureProviderMap; |
| 151 FeatureProviderMap dependency_providers_; | 150 FeatureProviderMap dependency_providers_; |
| 152 | 151 |
| 153 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); | 152 DISALLOW_COPY_AND_ASSIGN(ExtensionAPI); |
| 154 }; | 153 }; |
| 155 | 154 |
| 156 } // namespace extensions | 155 } // namespace extensions |
| 157 | 156 |
| 158 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ | 157 #endif // EXTENSIONS_COMMON_EXTENSION_API_H_ |
| OLD | NEW |