Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: extensions/common/features/feature.cc

Issue 241673002: Support a "policy" extension location in extension features files. At the same (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: format Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/common/features/feature.h" 5 #include "extensions/common/features/feature.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "extensions/common/extension.h"
13 14
14 namespace extensions { 15 namespace extensions {
15 16
16 // static 17 // static
17 Feature::Platform Feature::GetCurrentPlatform() { 18 Feature::Platform Feature::GetCurrentPlatform() {
18 #if defined(OS_CHROMEOS) 19 #if defined(OS_CHROMEOS)
19 return CHROMEOS_PLATFORM; 20 return CHROMEOS_PLATFORM;
20 #elif defined(OS_LINUX) 21 #elif defined(OS_LINUX)
21 return LINUX_PLATFORM; 22 return LINUX_PLATFORM;
22 #elif defined(OS_MACOSX) 23 #elif defined(OS_MACOSX)
23 return MACOSX_PLATFORM; 24 return MACOSX_PLATFORM;
24 #elif defined(OS_WIN) 25 #elif defined(OS_WIN)
25 return WIN_PLATFORM; 26 return WIN_PLATFORM;
26 #else 27 #else
27 return UNSPECIFIED_PLATFORM; 28 return UNSPECIFIED_PLATFORM;
28 #endif 29 #endif
29 } 30 }
30 31
31 // static 32 // static
32 Feature::Location Feature::ConvertLocation(Manifest::Location location) {
33 if (location == Manifest::COMPONENT)
34 return COMPONENT_LOCATION;
35 else
36 return UNSPECIFIED_LOCATION;
37 }
38
39 // static
40 Feature::Availability Feature::CreateAvailability(AvailabilityResult result, 33 Feature::Availability Feature::CreateAvailability(AvailabilityResult result,
41 const std::string& message) { 34 const std::string& message) {
42 return Availability(result, message); 35 return Availability(result, message);
43 } 36 }
44 37
38 Feature::Availability Feature::IsAvailableToExtension(
39 const Extension* extension) {
40 return IsAvailableToManifest(extension->id(),
41 extension->GetType(),
42 extension->location(),
43 extension->manifest_version());
44 }
45
45 Feature::Feature() : no_parent_(false) {} 46 Feature::Feature() : no_parent_(false) {}
46 47
47 Feature::~Feature() {} 48 Feature::~Feature() {}
48 49
49 } // namespace extensions 50 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698