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

Side by Side Diff: chrome/common/extensions/features/permission_feature.cc

Issue 12846011: Implement API features for the Extension API feature system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/common/extensions/features/permission_feature.h" 5 #include "chrome/common/extensions/features/permission_feature.h"
6 6
7 #include "chrome/common/extensions/permissions/permission_set.h" 7 #include "chrome/common/extensions/permissions/permission_set.h"
8 8
9 namespace extensions { 9 namespace extensions {
10 10
(...skipping 18 matching lines...) Expand all
29 // Optional permissions need to be checked so an API will not be set to 29 // Optional permissions need to be checked so an API will not be set to
30 // undefined forever, when it could just need optional permissions. 30 // undefined forever, when it could just need optional permissions.
31 if (extension && !extension->HasAPIPermission(name()) && 31 if (extension && !extension->HasAPIPermission(name()) &&
32 !extension->optional_permission_set()->HasAnyAccessToAPI(name())) { 32 !extension->optional_permission_set()->HasAnyAccessToAPI(name())) {
33 return CreateAvailability(NOT_PRESENT, extension->GetType()); 33 return CreateAvailability(NOT_PRESENT, extension->GetType());
34 } 34 }
35 35
36 return CreateAvailability(IS_AVAILABLE); 36 return CreateAvailability(IS_AVAILABLE);
37 } 37 }
38 38
39 bool PermissionFeature::Parse(const DictionaryValue* value) {
40 if (!SimpleFeature::Parse(value))
41 return false;
42
43 if (extension_types()->empty()) {
44 LOG(ERROR) << name() << ": Permission features must specify at least one "
45 << "value for extension_types.";
46 return false;
47 }
48
49 if (!GetContexts()->empty()) {
50 LOG(ERROR) << name() << ": Permission features do not support contexts.";
51 return false;
52 }
53 return true;
54 }
55
39 } // namespace 56 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698