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

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

Issue 12522004: Lazily load extension API schemas (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"
8
7 namespace extensions { 9 namespace extensions {
8 10
9 PermissionFeature::PermissionFeature() { 11 PermissionFeature::PermissionFeature() {
10 } 12 }
11 13
12 PermissionFeature::~PermissionFeature() { 14 PermissionFeature::~PermissionFeature() {
13 } 15 }
14 16
15 Feature::Availability PermissionFeature::IsAvailableToContext( 17 Feature::Availability PermissionFeature::IsAvailableToContext(
16 const Extension* extension, 18 const Extension* extension,
17 Feature::Context context, 19 Feature::Context context,
20 const GURL& url,
18 Feature::Platform platform) const { 21 Feature::Platform platform) const {
19 Availability availability = SimpleFeature::IsAvailableToContext(extension, 22 Availability availability = SimpleFeature::IsAvailableToContext(extension,
20 context, 23 context,
24 url,
21 platform); 25 platform);
22 if (!availability.is_available()) 26 if (!availability.is_available())
23 return availability; 27 return availability;
24 28
25 if (!extension->HasAPIPermission(name())) 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.
31 if (extension && !extension->HasAPIPermission(name()) &&
32 !extension->optional_permission_set()->HasAnyAccessToAPI(name())) {
26 return CreateAvailability(NOT_PRESENT, extension->GetType()); 33 return CreateAvailability(NOT_PRESENT, extension->GetType());
34 }
27 35
28 return CreateAvailability(IS_AVAILABLE); 36 return CreateAvailability(IS_AVAILABLE);
29 } 37 }
30 38
31 } // namespace 39 } // 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