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