1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef EXTENSIONS_COMMON_FEATURES_JSON_FEATURE_PROVIDER_SOURCE_H_ 6 #define EXTENSIONS_COMMON_FEATURES_JSON_FEATURE_PROVIDER_SOURCE_H_ 7 8 #include <string> 9 10 #include "base/values.h" 11 12 namespace extensions { 13 14 // A JSONFeatureProviderSource loads JSON dictionary files that 15 // define features. 16 class JSONFeatureProviderSource { 17 public: 18 explicit JSONFeatureProviderSource(const std::string& name); 19 ~JSONFeatureProviderSource(); 20 21 // Adds the JSON dictionary file to this provider, merging its values with 22 // the current dictionary. Key collisions are treated as errors. 23 void LoadJSON(int resource_id); 24 25 // Returns the parsed dictionary. 26 const base::DictionaryValue& dictionary() { return dictionary_; } 27 28 private: 29 // The name of this feature type; only used for debugging. 30 const std::string name_; 31 32 base::DictionaryValue dictionary_; 33 34 DISALLOW_COPY_AND_ASSIGN(JSONFeatureProviderSource); 35 }; 36 37 } // namespace extensions 38 39 #endif // EXTENSIONS_COMMON_FEATURES_JSON_FEATURE_PROVIDER_SOURCE_H_ 40