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