Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / extensions / common / features / feature.cc
blob21aa2890bd6b6f5cdaa608ea0be8d89d8ba40612
1 // Copyright 2013 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.
5 #include "extensions/common/features/feature.h"
7 #include <map>
9 #include "base/command_line.h"
10 #include "base/lazy_instance.h"
11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h"
13 #include "extensions/common/extension.h"
14 #include "extensions/common/manifest.h"
16 namespace extensions {
18 // static
19 Feature::Platform Feature::GetCurrentPlatform() {
20 #if defined(OS_CHROMEOS)
21 return CHROMEOS_PLATFORM;
22 #elif defined(OS_LINUX)
23 return LINUX_PLATFORM;
24 #elif defined(OS_MACOSX)
25 return MACOSX_PLATFORM;
26 #elif defined(OS_WIN)
27 return WIN_PLATFORM;
28 #else
29 return UNSPECIFIED_PLATFORM;
30 #endif
33 Feature::Availability Feature::IsAvailableToExtension(
34 const Extension* extension) const {
35 return IsAvailableToManifest(extension->id(),
36 extension->GetType(),
37 extension->location(),
38 extension->manifest_version());
41 Feature::Availability Feature::IsAvailableToEnvironment() const {
42 return IsAvailableToManifest("", // extension_id
43 Manifest::TYPE_UNKNOWN,
44 Manifest::INVALID_LOCATION,
45 -1); // manifest_version
48 Feature::Feature() : no_parent_(false) {}
50 Feature::~Feature() {}
52 } // namespace extensions