| 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 | 499 |
| 500 // The webRequest permission implies the internal version as well. | 500 // The webRequest permission implies the internal version as well. |
| 501 if (apis_.find(APIPermission::kWebRequest) != apis_.end()) | 501 if (apis_.find(APIPermission::kWebRequest) != apis_.end()) |
| 502 apis_.insert(APIPermission::kWebRequestInternal); | 502 apis_.insert(APIPermission::kWebRequestInternal); |
| 503 | 503 |
| 504 // The fileBrowserHandler permission implies the internal version as well. | 504 // The fileBrowserHandler permission implies the internal version as well. |
| 505 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end()) | 505 if (apis_.find(APIPermission::kFileBrowserHandler) != apis_.end()) |
| 506 apis_.insert(APIPermission::kFileBrowserHandlerInternal); | 506 apis_.insert(APIPermission::kFileBrowserHandlerInternal); |
| 507 | 507 |
| 508 // Add the scriptable hosts. | 508 // Add the scriptable hosts. |
| 509 for (UserScriptList::const_iterator content_script = | 509 for (extensions::UserScriptList::const_iterator content_script = |
| 510 extension->content_scripts().begin(); | 510 extension->content_scripts().begin(); |
| 511 content_script != extension->content_scripts().end(); ++content_script) { | 511 content_script != extension->content_scripts().end(); ++content_script) { |
| 512 URLPatternSet::const_iterator pattern = | 512 URLPatternSet::const_iterator pattern = |
| 513 content_script->url_patterns().begin(); | 513 content_script->url_patterns().begin(); |
| 514 for (; pattern != content_script->url_patterns().end(); ++pattern) | 514 for (; pattern != content_script->url_patterns().end(); ++pattern) |
| 515 scriptable_hosts_.AddPattern(*pattern); | 515 scriptable_hosts_.AddPattern(*pattern); |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 | 518 |
| 519 void PermissionSet::InitEffectiveHosts() { | 519 void PermissionSet::InitEffectiveHosts() { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 std::set<std::string> new_hosts_only; | 578 std::set<std::string> new_hosts_only; |
| 579 | 579 |
| 580 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 580 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
| 581 old_hosts_set.begin(), old_hosts_set.end(), | 581 old_hosts_set.begin(), old_hosts_set.end(), |
| 582 std::inserter(new_hosts_only, new_hosts_only.begin())); | 582 std::inserter(new_hosts_only, new_hosts_only.begin())); |
| 583 | 583 |
| 584 return !new_hosts_only.empty(); | 584 return !new_hosts_only.empty(); |
| 585 } | 585 } |
| 586 | 586 |
| 587 } // namespace extensions | 587 } // namespace extensions |
| OLD | NEW |