| 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 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 return true; | 538 return true; |
| 539 | 539 |
| 540 const URLPatternSet& old_list = effective_hosts(); | 540 const URLPatternSet& old_list = effective_hosts(); |
| 541 const URLPatternSet& new_list = permissions->effective_hosts(); | 541 const URLPatternSet& new_list = permissions->effective_hosts(); |
| 542 | 542 |
| 543 // TODO(jstritar): This is overly conservative with respect to subdomains. | 543 // TODO(jstritar): This is overly conservative with respect to subdomains. |
| 544 // For example, going from *.google.com to www.google.com will be | 544 // For example, going from *.google.com to www.google.com will be |
| 545 // considered an elevation, even though it is not (http://crbug.com/65337). | 545 // considered an elevation, even though it is not (http://crbug.com/65337). |
| 546 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); | 546 std::set<std::string> new_hosts_set(GetDistinctHosts(new_list, false, false)); |
| 547 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); | 547 std::set<std::string> old_hosts_set(GetDistinctHosts(old_list, false, false)); |
| 548 std::set<std::string> new_hosts_only; | 548 std::set<std::string> new_hosts_only = |
| 549 | 549 base::STLSetDifference<std::set<std::string> >(new_hosts_set, |
| 550 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 550 old_hosts_set); |
| 551 old_hosts_set.begin(), old_hosts_set.end(), | |
| 552 std::inserter(new_hosts_only, new_hosts_only.begin())); | |
| 553 | 551 |
| 554 return !new_hosts_only.empty(); | 552 return !new_hosts_only.empty(); |
| 555 } | 553 } |
| 556 | 554 |
| 557 } // namespace extensions | 555 } // namespace extensions |
| OLD | NEW |