| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 | 458 |
| 459 std::string host = i->host(); | 459 std::string host = i->host(); |
| 460 | 460 |
| 461 // Add the subdomain wildcard back to the host, if necessary. | 461 // Add the subdomain wildcard back to the host, if necessary. |
| 462 if (i->match_subdomains()) | 462 if (i->match_subdomains()) |
| 463 host = "*." + host; | 463 host = "*." + host; |
| 464 | 464 |
| 465 // If the host has an RCD, split it off so we can detect duplicates. | 465 // If the host has an RCD, split it off so we can detect duplicates. |
| 466 std::string rcd; | 466 std::string rcd; |
| 467 size_t reg_len = net::RegistryControlledDomainService::GetRegistryLength( | 467 size_t reg_len = net::RegistryControlledDomainService::GetRegistryLength( |
| 468 host, false); | 468 host, |
| 469 net::RCDS::EXCLUDE_UNKNOWN_REGISTRIES, |
| 470 net::RCDS::EXCLUDE_PRIVATE_REGISTRIES); |
| 469 if (reg_len && reg_len != std::string::npos) { | 471 if (reg_len && reg_len != std::string::npos) { |
| 470 if (include_rcd) // else leave rcd empty | 472 if (include_rcd) // else leave rcd empty |
| 471 rcd = host.substr(host.size() - reg_len); | 473 rcd = host.substr(host.size() - reg_len); |
| 472 host = host.substr(0, host.size() - reg_len); | 474 host = host.substr(0, host.size() - reg_len); |
| 473 } | 475 } |
| 474 | 476 |
| 475 // Check if we've already seen this host. | 477 // Check if we've already seen this host. |
| 476 HostVector::iterator it = hosts_best_rcd.begin(); | 478 HostVector::iterator it = hosts_best_rcd.begin(); |
| 477 for (; it != hosts_best_rcd.end(); ++it) { | 479 for (; it != hosts_best_rcd.end(); ++it) { |
| 478 if (it->first == host) | 480 if (it->first == host) |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 std::set<std::string> new_hosts_only; | 573 std::set<std::string> new_hosts_only; |
| 572 | 574 |
| 573 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), | 575 std::set_difference(new_hosts_set.begin(), new_hosts_set.end(), |
| 574 old_hosts_set.begin(), old_hosts_set.end(), | 576 old_hosts_set.begin(), old_hosts_set.end(), |
| 575 std::inserter(new_hosts_only, new_hosts_only.begin())); | 577 std::inserter(new_hosts_only, new_hosts_only.begin())); |
| 576 | 578 |
| 577 return !new_hosts_only.empty(); | 579 return !new_hosts_only.empty(); |
| 578 } | 580 } |
| 579 | 581 |
| 580 } // namespace extensions | 582 } // namespace extensions |
| OLD | NEW |