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/permission_set.h" | 5 #include "chrome/common/extensions/permissions/permission_set.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 491 } |
492 | 492 |
493 void PermissionSet::InitImplicitPermissions() { | 493 void PermissionSet::InitImplicitPermissions() { |
494 // The webRequest permission implies the internal version as well. | 494 // The webRequest permission implies the internal version as well. |
495 if (apis_.find(APIPermission::kWebRequest) != apis_.end()) | 495 if (apis_.find(APIPermission::kWebRequest) != apis_.end()) |
496 apis_.insert(APIPermission::kWebRequestInternal); | 496 apis_.insert(APIPermission::kWebRequestInternal); |
497 | 497 |
498 // The fileBrowserHandler permission implies the internal version as well. | 498 // The fileBrowserHandler permission implies the internal version as well. |
499 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end()) | 499 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end()) |
500 apis_.insert(APIPermission::kFileBrowserHandlerInternal); | 500 apis_.insert(APIPermission::kFileBrowserHandlerInternal); |
| 501 |
| 502 // mediaGalleriesRead implies the mediaGalleries permission. |
| 503 if (apis_.find(APIPermission::kMediaGalleriesRead) != apis_.end()) |
| 504 apis_.insert(APIPermission::kMediaGalleries); |
501 } | 505 } |
502 | 506 |
503 void PermissionSet::InitImplicitExtensionPermissions( | 507 void PermissionSet::InitImplicitExtensionPermissions( |
504 const extensions::Extension* extension) { | 508 const extensions::Extension* extension) { |
505 // Add the implied permissions. | 509 // Add the implied permissions. |
506 if (!extension->plugins().empty()) | 510 if (!extension->plugins().empty()) |
507 apis_.insert(APIPermission::kPlugin); | 511 apis_.insert(APIPermission::kPlugin); |
508 | 512 |
509 if (!extension->devtools_url().is_empty()) | 513 if (!extension->devtools_url().is_empty()) |
510 apis_.insert(APIPermission::kDevtools); | 514 apis_.insert(APIPermission::kDevtools); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 std::set<std::string> new_hosts_only; | 586 std::set<std::string> new_hosts_only; |
583 | 587 |
584 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 588 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
585 old_hosts_set.begin(), old_hosts_set.end(), | 589 old_hosts_set.begin(), old_hosts_set.end(), |
586 std::inserter(new_hosts_only, new_hosts_only.begin())); | 590 std::inserter(new_hosts_only, new_hosts_only.begin())); |
587 | 591 |
588 return !new_hosts_only.empty(); | 592 return !new_hosts_only.empty(); |
589 } | 593 } |
590 | 594 |
591 } // namespace extensions | 595 } // namespace extensions |
OLD | NEW |