Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / extensions / common / features / json_feature_provider_source.h
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_FEATURE_JSON_FEATURE_PROVIDER_SOURCE_H_
6 #define EXTENSIONS_COMMON_FEATURE_JSON_FEATURE_PROVIDER_SOURCE_H_
7
8 #include "base/values.h"
9
10 namespace extensions {
11
12 // A JSONFeatureProviderSource loads JSON dictionary files that
13 // define features.
14 class JSONFeatureProviderSource {
15  public:
16   explicit JSONFeatureProviderSource(const std::string& name);
17   ~JSONFeatureProviderSource();
18
19   // Adds the JSON dictionary file to this provider, merging its values with
20   // the current dictionary. Key collisions are treated as errors.
21   void LoadJSON(int resource_id);
22
23   // Returns the parsed dictionary.
24   const base::DictionaryValue& dictionary() { return dictionary_; }
25
26  private:
27   // The name of this feature type; only used for debugging.
28   const std::string name_;
29
30   base::DictionaryValue dictionary_;
31
32   DISALLOW_COPY_AND_ASSIGN(JSONFeatureProviderSource);
33 };
34
35 }  // namespace extensions
36
37 #endif  // EXTENSIONS_COMMON_FEATURE_JSON_FEATURE_PROVIDER_SOURCE_H_