| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 continue; | 479 continue; |
| 480 | 480 |
| 481 std::string host = i->host(); | 481 std::string host = i->host(); |
| 482 | 482 |
| 483 // Add the subdomain wildcard back to the host, if necessary. | 483 // Add the subdomain wildcard back to the host, if necessary. |
| 484 if (i->match_subdomains()) | 484 if (i->match_subdomains()) |
| 485 host = "*." + host; | 485 host = "*." + host; |
| 486 | 486 |
| 487 // If the host has an RCD, split it off so we can detect duplicates. | 487 // If the host has an RCD, split it off so we can detect duplicates. |
| 488 std::string rcd; | 488 std::string rcd; |
| 489 size_t reg_len = net::RegistryControlledDomainService::GetRegistryLength( | 489 size_t reg_len = net::registry_controlled_domains::GetRegistryLength( |
| 490 host, false); | 490 host, |
| 491 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
| 492 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 491 if (reg_len && reg_len != std::string::npos) { | 493 if (reg_len && reg_len != std::string::npos) { |
| 492 if (include_rcd) // else leave rcd empty | 494 if (include_rcd) // else leave rcd empty |
| 493 rcd = host.substr(host.size() - reg_len); | 495 rcd = host.substr(host.size() - reg_len); |
| 494 host = host.substr(0, host.size() - reg_len); | 496 host = host.substr(0, host.size() - reg_len); |
| 495 } | 497 } |
| 496 | 498 |
| 497 // Check if we've already seen this host. | 499 // Check if we've already seen this host. |
| 498 HostVector::iterator it = hosts_best_rcd.begin(); | 500 HostVector::iterator it = hosts_best_rcd.begin(); |
| 499 for (; it != hosts_best_rcd.end(); ++it) { | 501 for (; it != hosts_best_rcd.end(); ++it) { |
| 500 if (it->first == host) | 502 if (it->first == host) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 std::set<std::string> new_hosts_only; | 595 std::set<std::string> new_hosts_only; |
| 594 | 596 |
| 595 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 597 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
| 596 old_hosts_set.begin(), old_hosts_set.end(), | 598 old_hosts_set.begin(), old_hosts_set.end(), |
| 597 std::inserter(new_hosts_only, new_hosts_only.begin())); | 599 std::inserter(new_hosts_only, new_hosts_only.begin())); |
| 598 | 600 |
| 599 return !new_hosts_only.empty(); | 601 return !new_hosts_only.empty(); |
| 600 } | 602 } |
| 601 | 603 |
| 602 } // namespace extensions | 604 } // namespace extensions |
| OLD | NEW |