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/manifest_handlers/permissions_parser.h" | 5 #include "extensions/common/manifest_handlers/permissions_parser.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // Parses the host and api permissions from the specified permission |key| | 100 // Parses the host and api permissions from the specified permission |key| |
101 // from |extension|'s manifest. | 101 // from |extension|'s manifest. |
102 bool ParseHelper(Extension* extension, | 102 bool ParseHelper(Extension* extension, |
103 const char* key, | 103 const char* key, |
104 APIPermissionSet* api_permissions, | 104 APIPermissionSet* api_permissions, |
105 URLPatternSet* host_permissions, | 105 URLPatternSet* host_permissions, |
106 base::string16* error) { | 106 base::string16* error) { |
107 if (!extension->manifest()->HasKey(key)) | 107 if (!extension->manifest()->HasKey(key)) |
108 return true; | 108 return true; |
109 | 109 |
110 const base::ListValue* permissions = NULL; | 110 const base::ListValue* permissions = nullptr; |
111 if (!extension->manifest()->GetList(key, &permissions)) { | 111 if (!extension->manifest()->GetList(key, &permissions)) { |
112 *error = ErrorUtils::FormatErrorMessageUTF16(errors::kInvalidPermissions, | 112 *error = ErrorUtils::FormatErrorMessageUTF16(errors::kInvalidPermissions, |
113 std::string()); | 113 std::string()); |
114 return false; | 114 return false; |
115 } | 115 } |
116 | 116 |
117 // NOTE: We need to get the APIPermission before we check if features | 117 // NOTE: We need to get the APIPermission before we check if features |
118 // associated with them are available because the feature system does not | 118 // associated with them are available because the feature system does not |
119 // know about aliases. | 119 // know about aliases. |
120 | 120 |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 // static | 348 // static |
349 scoped_refptr<const PermissionSet> PermissionsParser::GetOptionalPermissions( | 349 scoped_refptr<const PermissionSet> PermissionsParser::GetOptionalPermissions( |
350 const Extension* extension) { | 350 const Extension* extension) { |
351 DCHECK(extension->GetManifestData(keys::kOptionalPermissions)); | 351 DCHECK(extension->GetManifestData(keys::kOptionalPermissions)); |
352 return static_cast<const ManifestPermissions*>( | 352 return static_cast<const ManifestPermissions*>( |
353 extension->GetManifestData(keys::kOptionalPermissions)) | 353 extension->GetManifestData(keys::kOptionalPermissions)) |
354 ->permissions; | 354 ->permissions; |
355 } | 355 } |
356 | 356 |
357 } // namespace extensions | 357 } // namespace extensions |
OLD | NEW |