summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/features/api_feature.cc
blob: 0020632c422124bca738c7a39c997d81096f1f38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/common/extensions/features/api_feature.h"

namespace extensions {

APIFeature::APIFeature() : internal_(false) {
}

APIFeature::~APIFeature() {
}

bool APIFeature::IsInternal() const {
  return internal_;
}

std::string APIFeature::Parse(const DictionaryValue* value) {
  std::string error = SimpleFeature::Parse(value);
  if (!error.empty())
    return error;

  value->GetBoolean("internal", &internal_);

  if (GetContexts()->empty())
    return name() + ": API features must specify at least one context.";

  return "";
}

}  // namespace