| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/common/features/permission_feature.h" | 5 #include "extensions/common/features/permission_feature.h" |
| 6 | 6 |
| 7 #include "extensions/common/permissions/permission_set.h" | 7 #include "extensions/common/permissions/permission_set.h" |
| 8 #include "extensions/common/permissions/permissions_data.h" | 8 #include "extensions/common/permissions/permissions_data.h" |
| 9 | 9 |
| 10 namespace extensions { | 10 namespace extensions { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 platform); | 26 platform); |
| 27 if (!availability.is_available()) | 27 if (!availability.is_available()) |
| 28 return availability; | 28 return availability; |
| 29 | 29 |
| 30 if (extension && !extension->permissions_data()->HasAPIPermission(name())) | 30 if (extension && !extension->permissions_data()->HasAPIPermission(name())) |
| 31 return CreateAvailability(NOT_PRESENT, extension->GetType()); | 31 return CreateAvailability(NOT_PRESENT, extension->GetType()); |
| 32 | 32 |
| 33 return CreateAvailability(IS_AVAILABLE); | 33 return CreateAvailability(IS_AVAILABLE); |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool PermissionFeature::Validate(std::string* error) { | |
| 37 if (!SimpleFeature::Validate(error)) | |
| 38 return false; | |
| 39 | |
| 40 if (extension_types().empty()) { | |
| 41 *error = name() + ": Permission features must specify at least one " + | |
| 42 "value for extension_types."; | |
| 43 return false; | |
| 44 } | |
| 45 | |
| 46 if (!contexts().empty()) { | |
| 47 *error = name() + ": Permission features do not support contexts."; | |
| 48 return false; | |
| 49 } | |
| 50 | |
| 51 return true; | |
| 52 } | |
| 53 | |
| 54 } // namespace extensions | 36 } // namespace extensions |
| OLD | NEW |