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