| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "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 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 it != hosts_best_rcd.end(); ++it) | 517 it != hosts_best_rcd.end(); ++it) |
| 518 distinct_hosts.insert(it->first + it->second); | 518 distinct_hosts.insert(it->first + it->second); |
| 519 return distinct_hosts; | 519 return distinct_hosts; |
| 520 } | 520 } |
| 521 | 521 |
| 522 void PermissionSet::InitImplicitPermissions() { | 522 void PermissionSet::InitImplicitPermissions() { |
| 523 // The downloads permission implies the internal version as well. | 523 // The downloads permission implies the internal version as well. |
| 524 if (apis_.find(APIPermission::kDownloads) != apis_.end()) | 524 if (apis_.find(APIPermission::kDownloads) != apis_.end()) |
| 525 apis_.insert(APIPermission::kDownloadsInternal); | 525 apis_.insert(APIPermission::kDownloadsInternal); |
| 526 | 526 |
| 527 // TODO(fsamuel): Is there a better way to request access to the WebRequest |
| 528 // API without exposing it to the Chrome App? |
| 529 if (apis_.find(APIPermission::kWebView) != apis_.end()) |
| 530 apis_.insert(APIPermission::kWebRequestInternal); |
| 531 |
| 527 // The webRequest permission implies the internal version as well. | 532 // The webRequest permission implies the internal version as well. |
| 528 if (apis_.find(APIPermission::kWebRequest) != apis_.end()) | 533 if (apis_.find(APIPermission::kWebRequest) != apis_.end()) |
| 529 apis_.insert(APIPermission::kWebRequestInternal); | 534 apis_.insert(APIPermission::kWebRequestInternal); |
| 530 | 535 |
| 531 // The fileBrowserHandler permission implies the internal version as well. | 536 // The fileBrowserHandler permission implies the internal version as well. |
| 532 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end()) | 537 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end()) |
| 533 apis_.insert(APIPermission::kFileBrowserHandlerInternal); | 538 apis_.insert(APIPermission::kFileBrowserHandlerInternal); |
| 534 } | 539 } |
| 535 | 540 |
| 536 void PermissionSet::InitEffectiveHosts() { | 541 void PermissionSet::InitEffectiveHosts() { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 595 std::set<std::string> new_hosts_only; | 600 std::set<std::string> new_hosts_only; |
| 596 | 601 |
| 597 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 602 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
| 598 old_hosts_set.begin(), old_hosts_set.end(), | 603 old_hosts_set.begin(), old_hosts_set.end(), |
| 599 std::inserter(new_hosts_only, new_hosts_only.begin())); | 604 std::inserter(new_hosts_only, new_hosts_only.begin())); |
| 600 | 605 |
| 601 return !new_hosts_only.empty(); | 606 return !new_hosts_only.empty(); |
| 602 } | 607 } |
| 603 | 608 |
| 604 } // namespace extensions | 609 } // namespace extensions |
| OLD | NEW |