summaryrefslogtreecommitdiff
path: root/chromium/extensions/common/features/api_feature.cc
blob: e3e4c91b6db3796a5d548d38b6ef5bd9576fca3e (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 2014 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 "extensions/common/features/api_feature.h"

namespace extensions {

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

APIFeature::~APIFeature() {
}

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

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

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

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

  return std::string();
}

}  // namespace extensions