Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/common/permissions/permission_message_util.h" | 5 #include "extensions/common/permissions/permission_message_util.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "extensions/common/permissions/permission_message.h" | 9 #include "extensions/common/permissions/permission_message.h" |
| 10 #include "extensions/common/permissions/permission_set.h" | 10 #include "extensions/common/permissions/permission_set.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 for (URLPatternSet::const_iterator i = host_patterns.begin(); | 102 for (URLPatternSet::const_iterator i = host_patterns.begin(); |
| 103 i != host_patterns.end(); | 103 i != host_patterns.end(); |
| 104 ++i) { | 104 ++i) { |
| 105 if (exclude_file_scheme && i->scheme() == url::kFileScheme) | 105 if (exclude_file_scheme && i->scheme() == url::kFileScheme) |
| 106 continue; | 106 continue; |
| 107 | 107 |
| 108 std::string host = i->host(); | 108 std::string host = i->host(); |
| 109 | 109 |
| 110 // Add the subdomain wildcard back to the host, if necessary. | 110 // Add the subdomain wildcard back to the host, if necessary. |
| 111 if (i->match_subdomains()) | 111 if (i->match_subdomains()) |
| 112 host = "*." + host; | 112 host = "all " + host + " sites"; |
|
not at google - send to devlin
2014/07/21 21:13:44
this won't localise, you need to actually update t
| |
| 113 | 113 |
| 114 // If the host has an RCD, split it off so we can detect duplicates. | 114 // If the host has an RCD, split it off so we can detect duplicates. |
| 115 std::string rcd; | 115 std::string rcd; |
| 116 size_t reg_len = net::registry_controlled_domains::GetRegistryLength( | 116 size_t reg_len = net::registry_controlled_domains::GetRegistryLength( |
| 117 host, | 117 host, |
| 118 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | 118 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
| 119 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 119 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 120 if (reg_len && reg_len != std::string::npos) { | 120 if (reg_len && reg_len != std::string::npos) { |
| 121 if (include_rcd) // else leave rcd empty | 121 if (include_rcd) // else leave rcd empty |
| 122 rcd = host.substr(host.size() - reg_len); | 122 rcd = host.substr(host.size() - reg_len); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 141 // Build up the final vector by concatenating hosts and RCDs. | 141 // Build up the final vector by concatenating hosts and RCDs. |
| 142 std::set<std::string> distinct_hosts; | 142 std::set<std::string> distinct_hosts; |
| 143 for (HostVector::iterator it = hosts_best_rcd.begin(); | 143 for (HostVector::iterator it = hosts_best_rcd.begin(); |
| 144 it != hosts_best_rcd.end(); | 144 it != hosts_best_rcd.end(); |
| 145 ++it) | 145 ++it) |
| 146 distinct_hosts.insert(it->first + it->second); | 146 distinct_hosts.insert(it->first + it->second); |
| 147 return distinct_hosts; | 147 return distinct_hosts; |
| 148 } | 148 } |
| 149 | 149 |
| 150 } // namespace permission_message_util | 150 } // namespace permission_message_util |
| OLD | NEW |