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/permissions/api_permission_set.h" | 5 #include "chrome/common/extensions/permissions/api_permission_set.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" |
8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
9 #include "base/values.h" | 10 #include "base/values.h" |
10 #include "chrome/common/extensions/extension_manifest_constants.h" | 11 #include "chrome/common/extensions/extension_manifest_constants.h" |
11 #include "chrome/common/extensions/permissions/permissions_info.h" | 12 #include "chrome/common/extensions/permissions/permissions_info.h" |
12 #include "extensions/common/error_utils.h" | 13 #include "extensions/common/error_utils.h" |
13 | 14 |
14 namespace errors = extension_manifest_errors; | 15 namespace errors = extension_manifest_errors; |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 continue; | 329 continue; |
329 } | 330 } |
330 | 331 |
331 if (!CreateAPIPermission(permission_str, permission_value, source, | 332 if (!CreateAPIPermission(permission_str, permission_value, source, |
332 api_permissions, error, unhandled_permissions)) | 333 api_permissions, error, unhandled_permissions)) |
333 return false; | 334 return false; |
334 } | 335 } |
335 return true; | 336 return true; |
336 } | 337 } |
337 | 338 |
| 339 void APIPermissionSet::AddImpliedPermissions() { |
| 340 // The fileSystem.write and fileSystem.directory permissions imply |
| 341 // fileSystem.writeDirectory. |
| 342 // TODO(sammc): Remove this. See http://crbug.com/284849. |
| 343 if (ContainsKey(map_, APIPermission::kFileSystemWrite) && |
| 344 ContainsKey(map_, APIPermission::kFileSystemDirectory)) { |
| 345 insert(APIPermission::kFileSystemWriteDirectory); |
| 346 } |
| 347 } |
| 348 |
338 } // namespace extensions | 349 } // namespace extensions |
OLD | NEW |