| 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/api_feature.h" | 5 #include "extensions/common/features/api_feature.h" |
| 6 | 6 |
| 7 namespace extensions { | 7 namespace extensions { |
| 8 | 8 |
| 9 APIFeature::APIFeature() | 9 APIFeature::APIFeature() {} |
| 10 : internal_(false) {} | |
| 11 | 10 |
| 12 APIFeature::~APIFeature() { | 11 APIFeature::~APIFeature() { |
| 13 } | 12 } |
| 14 | 13 |
| 15 bool APIFeature::IsInternal() const { | 14 bool APIFeature::Validate(std::string* error) { |
| 16 return internal_; | 15 if (!SimpleFeature::Validate(error)) |
| 17 } | 16 return false; |
| 18 | 17 |
| 19 std::string APIFeature::Parse(const base::DictionaryValue* value) { | 18 if (contexts()->empty()) { |
| 20 std::string error = SimpleFeature::Parse(value); | 19 *error = name() + ": API features must specify at least one context."; |
| 21 if (!error.empty()) | 20 return false; |
| 22 return error; | 21 } |
| 23 | 22 |
| 24 value->GetBoolean("internal", &internal_); | 23 return true; |
| 25 | |
| 26 if (contexts()->empty()) | |
| 27 return name() + ": API features must specify at least one context."; | |
| 28 | |
| 29 return std::string(); | |
| 30 } | 24 } |
| 31 | 25 |
| 32 } // namespace extensions | 26 } // namespace extensions |
| OLD | NEW |