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

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: fixed memory leak 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 std::string PermissionFeature::Parse(const DictionaryValue* value) {
40 std::string error = SimpleFeature::Parse(value);
41 if (!error.empty())
42 return error;
43
44 if (extension_types()->empty()) {
45 return name() + ": Permission features must specify at least one " +
46 "value for extension_types.";
47 }
48
49 if (!GetContexts()->empty())
50 return name() + ": Permission features do not support contexts.";
51
52 return "";
53 }
54
39 } // namespace 55 } // namespace
OLDNEW
« no previous file with comments | « chrome/common/extensions/features/permission_feature.h ('k') | chrome/common/extensions/features/simple_feature.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698