OLD | NEW |
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 #include "extensions/common/features/base_feature_provider.h" | 5 #include "extensions/common/features/base_feature_provider.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
8 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
9 #include "extensions/common/features/feature.h" | 11 #include "extensions/common/features/feature.h" |
10 | 12 |
11 namespace extensions { | 13 namespace extensions { |
12 | 14 |
13 BaseFeatureProvider::BaseFeatureProvider() {} | 15 BaseFeatureProvider::BaseFeatureProvider() {} |
14 BaseFeatureProvider::~BaseFeatureProvider() {} | 16 BaseFeatureProvider::~BaseFeatureProvider() {} |
15 | 17 |
16 const FeatureMap& BaseFeatureProvider::GetAllFeatures() const { | 18 const FeatureMap& BaseFeatureProvider::GetAllFeatures() const { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 54 |
53 std::vector<Feature*> result; | 55 std::vector<Feature*> result; |
54 result.reserve(std::distance(first_child, after_children)); | 56 result.reserve(std::distance(first_child, after_children)); |
55 for (FeatureMap::const_iterator it = first_child; it != after_children; | 57 for (FeatureMap::const_iterator it = first_child; it != after_children; |
56 ++it) { | 58 ++it) { |
57 result.push_back(it->second.get()); | 59 result.push_back(it->second.get()); |
58 } | 60 } |
59 return result; | 61 return result; |
60 } | 62 } |
61 | 63 |
| 64 void BaseFeatureProvider::AddFeature(base::StringPiece name, |
| 65 std::unique_ptr<Feature> feature) { |
| 66 features_[name.as_string()] = std::move(feature); |
| 67 } |
| 68 |
62 } // namespace extensions | 69 } // namespace extensions |
OLD | NEW |