summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/permission_feature.cc
blob: f0931926c22b51b7cf20e3bd4de4a679feadddf0 (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
33
// 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/permission_feature.h"

#include "chrome/common/extensions/extension_permission_set.h"

namespace extensions {

PermissionFeature::PermissionFeature() {
}

PermissionFeature::~PermissionFeature() {
}

Feature::Availability PermissionFeature::IsAvailableToContext(
    const Extension* extension,
    Feature::Context context,
    Feature::Platform platform) const {
  Availability availability = Feature::IsAvailableToContext(extension,
                                                            context,
                                                            platform);
  if (availability != IS_AVAILABLE)
    return availability;

  if (!extension->HasAPIPermission(name()))
    return NOT_PRESENT;

  return IS_AVAILABLE;
}

}  // namespace