Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: extensions/common/features/base_feature_provider.h

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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_FEATURES_BASE_FEATURE_PROVIDER_H_ 5 #ifndef EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_
6 #define EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_ 6 #define EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/memory/scoped_ptr.h"
13 #include "extensions/common/features/feature_provider.h" 13 #include "extensions/common/features/feature_provider.h"
14 #include "extensions/common/features/simple_feature.h" 14 #include "extensions/common/features/simple_feature.h"
15 15
16 namespace Base { 16 namespace Base {
17 class DictionaryValue; 17 class DictionaryValue;
18 } 18 }
19 19
20 namespace extensions { 20 namespace extensions {
21 21
22 // Reads Features out of a simple JSON file description. 22 // Reads Features out of a simple JSON file description.
23 class BaseFeatureProvider : public FeatureProvider { 23 class BaseFeatureProvider : public FeatureProvider {
24 public: 24 public:
25 typedef SimpleFeature*(*FeatureFactory)(); 25 typedef SimpleFeature*(*FeatureFactory)();
26 26
27 // Creates a new BaseFeatureProvider. Pass null to |factory| to have the 27 // Creates a new BaseFeatureProvider. Pass null to |factory| to have the
28 // provider create plain old Feature instances. 28 // provider create plain old Feature instances.
29 BaseFeatureProvider(const base::DictionaryValue& root, 29 BaseFeatureProvider(const base::DictionaryValue& root,
30 FeatureFactory factory); 30 FeatureFactory factory);
31 ~BaseFeatureProvider() override; 31 ~BaseFeatureProvider() override;
32 32
33 // Gets the feature |feature_name|, if it exists. 33 // Gets the feature |feature_name|, if it exists.
34 Feature* GetFeature(const std::string& feature_name) const override; 34 Feature* GetFeature(const std::string& feature_name) const override;
35 Feature* GetParent(Feature* feature) const override; 35 Feature* GetParent(Feature* feature) const override;
36 std::vector<Feature*> GetChildren(const Feature& parent) const override; 36 std::vector<Feature*> GetChildren(const Feature& parent) const override;
37 37
38 const FeatureMap& GetAllFeatures() const override; 38 const FeatureMap& GetAllFeatures() const override;
39 39
40 private: 40 private:
41 std::map<std::string, scoped_ptr<Feature>> features_; 41 std::map<std::string, std::unique_ptr<Feature>> features_;
42 42
43 // Populated on first use. 43 // Populated on first use.
44 mutable std::vector<std::string> feature_names_; 44 mutable std::vector<std::string> feature_names_;
45 45
46 FeatureFactory factory_; 46 FeatureFactory factory_;
47 }; 47 };
48 48
49 } // namespace extensions 49 } // namespace extensions
50 50
51 #endif // EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_ 51 #endif // EXTENSIONS_COMMON_FEATURES_BASE_FEATURE_PROVIDER_H_
OLDNEW
« no previous file with comments | « extensions/common/extensions_client.h ('k') | extensions/common/features/base_feature_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698