| 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" | 7 #include "chrome/common/extensions/permissions/permission_set.h" |
| 8 | 8 |
| 9 namespace extensions { | 9 namespace extensions { |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Optional permissions need to be checked so an API will not be set to | 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. | 30 // undefined forever, when it could just need optional permissions. |
| 31 if (extension && !extension->HasAPIPermission(name()) && | 31 if (extension && !extension->HasAPIPermission(name()) && |
| 32 !extension->optional_permission_set()->HasAnyAccessToAPI(name())) { | 32 !extension->optional_permission_set()->HasAnyAccessToAPI(name())) { |
| 33 return CreateAvailability(NOT_PRESENT, extension->GetType()); | 33 return CreateAvailability(NOT_PRESENT, extension->GetType()); |
| 34 } | 34 } |
| 35 | 35 |
| 36 return CreateAvailability(IS_AVAILABLE); | 36 return CreateAvailability(IS_AVAILABLE); |
| 37 } | 37 } |
| 38 | 38 |
| 39 std::string PermissionFeature::Parse(const DictionaryValue* value) { |
| 40 std::string error = SimpleFeature::Parse(value); |
| 41 if (!error.empty()) |
| 42 return error; |
| 43 |
| 44 if (extension_types()->empty()) { |
| 45 return name() + ": Permission features must specify at least one " + |
| 46 "value for extension_types."; |
| 47 } |
| 48 |
| 49 if (!GetContexts()->empty()) |
| 50 return name() + ": Permission features do not support contexts."; |
| 51 |
| 52 return ""; |
| 53 } |
| 54 |
| 39 } // namespace | 55 } // namespace |
| OLD | NEW |