OLD | NEW |
---|---|
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 if (extension && !extension->HasAPIPermission(name()) && |
30 !extension->optional_permission_set()->HasAnyAccessToAPI(name())) { | |
not at google - send to devlin
2013/03/22 23:04:30
could you explain this in a comment?
| |
26 return CreateAvailability(NOT_PRESENT, extension->GetType()); | 31 return CreateAvailability(NOT_PRESENT, extension->GetType()); |
32 } | |
27 | 33 |
28 return CreateAvailability(IS_AVAILABLE); | 34 return CreateAvailability(IS_AVAILABLE); |
29 } | 35 } |
30 | 36 |
31 } // namespace | 37 } // namespace |
OLD | NEW |