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