OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shared_module_info.h" | 5 #include "extensions/common/manifest_handlers/shared_module_info.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/version.h" | 12 #include "base/version.h" |
13 #include "extensions/common/constants.h" | 13 #include "extensions/common/constants.h" |
14 #include "extensions/common/error_utils.h" | 14 #include "extensions/common/error_utils.h" |
15 #include "extensions/common/manifest_constants.h" | 15 #include "extensions/common/manifest_constants.h" |
16 #include "extensions/common/permissions/permission_set.h" | 16 #include "extensions/common/permissions/permission_set.h" |
| 17 #include "extensions/common/permissions/permissions_data.h" |
17 | 18 |
18 namespace extensions { | 19 namespace extensions { |
19 | 20 |
20 namespace keys = manifest_keys; | 21 namespace keys = manifest_keys; |
21 namespace values = manifest_values; | 22 namespace values = manifest_values; |
22 namespace errors = manifest_errors; | 23 namespace errors = manifest_errors; |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 const char kSharedModule[] = "shared_module"; | 27 const char kSharedModule[] = "shared_module"; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 237 } |
237 | 238 |
238 bool SharedModuleHandler::Validate( | 239 bool SharedModuleHandler::Validate( |
239 const Extension* extension, | 240 const Extension* extension, |
240 std::string* error, | 241 std::string* error, |
241 std::vector<InstallWarning>* warnings) const { | 242 std::vector<InstallWarning>* warnings) const { |
242 // Extensions that export resources should not have any permissions of their | 243 // Extensions that export resources should not have any permissions of their |
243 // own, instead they rely on the permissions of the extensions which import | 244 // own, instead they rely on the permissions of the extensions which import |
244 // them. | 245 // them. |
245 if (SharedModuleInfo::IsSharedModule(extension) && | 246 if (SharedModuleInfo::IsSharedModule(extension) && |
246 !extension->GetActivePermissions()->IsEmpty()) { | 247 !extension->permissions_data()->active_permissions()->IsEmpty()) { |
247 *error = errors::kInvalidExportPermissions; | 248 *error = errors::kInvalidExportPermissions; |
248 return false; | 249 return false; |
249 } | 250 } |
250 return true; | 251 return true; |
251 } | 252 } |
252 | 253 |
253 const std::vector<std::string> SharedModuleHandler::Keys() const { | 254 const std::vector<std::string> SharedModuleHandler::Keys() const { |
254 static const char* keys[] = { | 255 static const char* keys[] = { |
255 keys::kExport, | 256 keys::kExport, |
256 keys::kImport | 257 keys::kImport |
257 }; | 258 }; |
258 return std::vector<std::string>(keys, keys + arraysize(keys)); | 259 return std::vector<std::string>(keys, keys + arraysize(keys)); |
259 } | 260 } |
260 | 261 |
261 } // namespace extensions | 262 } // namespace extensions |
OLD | NEW |