OLD | NEW |
1 //* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ | 1 //* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
2 /* ***** BEGIN LICENSE BLOCK ***** | 2 /* ***** BEGIN LICENSE BLOCK ***** |
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 | 3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
4 * | 4 * |
5 * The contents of this file are subject to the Mozilla Public License Version | 5 * The contents of this file are subject to the Mozilla Public License Version |
6 * 1.1 (the "License"); you may not use this file except in compliance with | 6 * 1.1 (the "License"); you may not use this file except in compliance with |
7 * the License. You may obtain a copy of the License at | 7 * the License. You may obtain a copy of the License at |
8 * http://www.mozilla.org/MPL/ | 8 * http://www.mozilla.org/MPL/ |
9 * | 9 * |
10 * Software distributed under the License is distributed on an "AS IS" basis, | 10 * Software distributed under the License is distributed on an "AS IS" basis, |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 } | 289 } |
290 | 290 |
291 // static | 291 // static |
292 void RegistryControlledDomainService::UseDomainData(const std::string& data) { | 292 void RegistryControlledDomainService::UseDomainData(const std::string& data) { |
293 RegistryControlledDomainService* instance = GetInstance(); | 293 RegistryControlledDomainService* instance = GetInstance(); |
294 instance->domain_data_ = data; | 294 instance->domain_data_ = data; |
295 instance->ParseDomainData(); | 295 instance->ParseDomainData(); |
296 } | 296 } |
297 | 297 |
298 void RegistryControlledDomainService::Init() { | 298 void RegistryControlledDomainService::Init() { |
299 domain_data_ = NetModule::GetResource(IDR_EFFECTIVE_TLD_NAMES); | 299 domain_data_ = NetModule::GetResource(IDR_EFFECTIVE_TLD_NAMES).as_string(); |
300 if (domain_data_.empty()) { | 300 if (domain_data_.empty()) { |
301 // The resource file isn't present for some unit tests, for example. Fall | 301 // The resource file isn't present for some unit tests, for example. Fall |
302 // back to a tiny, basic list of rules in that case. | 302 // back to a tiny, basic list of rules in that case. |
303 domain_data_ = kDefaultDomainData; | 303 domain_data_ = kDefaultDomainData; |
304 } | 304 } |
305 ParseDomainData(); | 305 ParseDomainData(); |
306 } | 306 } |
307 | 307 |
308 void RegistryControlledDomainService::ParseDomainData() { | 308 void RegistryControlledDomainService::ParseDomainData() { |
309 domain_map_.clear(); | 309 domain_map_.clear(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // If the segments are of equal length, compare their contents; otherwise, | 353 // If the segments are of equal length, compare their contents; otherwise, |
354 // the shorter segment is "less than" the longer one. | 354 // the shorter segment is "less than" the longer one. |
355 if (len_ == other.len_) { | 355 if (len_ == other.len_) { |
356 int comparison = strncmp(data_ + begin_, other.data_ + other.begin_, len_); | 356 int comparison = strncmp(data_ + begin_, other.data_ + other.begin_, len_); |
357 return (comparison < 0); | 357 return (comparison < 0); |
358 } | 358 } |
359 return (len_ < other.len_); | 359 return (len_ < other.len_); |
360 } | 360 } |
361 | 361 |
362 } // namespace net | 362 } // namespace net |
OLD | NEW |