| 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/json_feature_provider.h" | 5 #include "extensions/common/features/json_feature_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <stack> | 9 #include <stack> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 base::DictionaryValue* dict; | 124 base::DictionaryValue* dict; |
| 125 if (!entry->GetAsDictionary(&dict)) { | 125 if (!entry->GetAsDictionary(&dict)) { |
| 126 LOG(ERROR) << iter.key() << ": Feature rules must be dictionaries."; | 126 LOG(ERROR) << iter.key() << ": Feature rules must be dictionaries."; |
| 127 continue; | 127 continue; |
| 128 } | 128 } |
| 129 | 129 |
| 130 std::unique_ptr<SimpleFeature> feature((*factory_)()); | 130 std::unique_ptr<SimpleFeature> feature((*factory_)()); |
| 131 if (!ParseFeature(dict, iter.key(), feature.get())) | 131 if (!ParseFeature(dict, iter.key(), feature.get())) |
| 132 continue; | 132 continue; |
| 133 | 133 |
| 134 features->push_back(std::move(feature)); | 134 features->push_back(feature.release()); |
| 135 } | 135 } |
| 136 | 136 |
| 137 std::unique_ptr<ComplexFeature> feature( | 137 std::unique_ptr<ComplexFeature> feature( |
| 138 new ComplexFeature(std::move(features))); | 138 new ComplexFeature(features.release())); |
| 139 feature->set_name(iter.key()); | 139 feature->set_name(iter.key()); |
| 140 | 140 |
| 141 AddFeature(iter.key(), std::move(feature)); | 141 AddFeature(iter.key(), feature.release()); |
| 142 } else { | 142 } else { |
| 143 LOG(ERROR) << iter.key() << ": Feature description must be dictionary or" | 143 LOG(ERROR) << iter.key() << ": Feature description must be dictionary or" |
| 144 << " list of dictionaries."; | 144 << " list of dictionaries."; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| 149 JSONFeatureProvider::~JSONFeatureProvider() {} | 149 JSONFeatureProvider::~JSONFeatureProvider() {} |
| 150 | 150 |
| 151 } // namespace extensions | 151 } // namespace extensions |
| OLD | NEW |