OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/base/sdch_manager.h" | 5 #include "net/base/sdch_manager.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 std::string value(dictionary_text, value_start, line_end - value_start); | 398 std::string value(dictionary_text, value_start, line_end - value_start); |
399 name = base::StringToLowerASCII(name); | 399 name = base::StringToLowerASCII(name); |
400 if (name == "domain") { | 400 if (name == "domain") { |
401 domain = value; | 401 domain = value; |
402 } else if (name == "path") { | 402 } else if (name == "path") { |
403 path = value; | 403 path = value; |
404 } else if (name == "format-version") { | 404 } else if (name == "format-version") { |
405 if (value != "1.0") | 405 if (value != "1.0") |
406 return SDCH_DICTIONARY_UNSUPPORTED_VERSION; | 406 return SDCH_DICTIONARY_UNSUPPORTED_VERSION; |
407 } else if (name == "max-age") { | 407 } else if (name == "max-age") { |
408 int64 seconds; | 408 int64_t seconds; |
409 base::StringToInt64(value, &seconds); | 409 base::StringToInt64(value, &seconds); |
410 expiration = base::Time::Now() + base::TimeDelta::FromSeconds(seconds); | 410 expiration = base::Time::Now() + base::TimeDelta::FromSeconds(seconds); |
411 } else if (name == "port") { | 411 } else if (name == "port") { |
412 int port; | 412 int port; |
413 base::StringToInt(value, &port); | 413 base::StringToInt(value, &port); |
414 if (port >= 0) | 414 if (port >= 0) |
415 ports.insert(port); | 415 ports.insert(port); |
416 } | 416 } |
417 } | 417 } |
418 | 418 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 entry_dict->SetInteger("tries", it->second.count); | 514 entry_dict->SetInteger("tries", it->second.count); |
515 entry_dict->SetInteger("reason", it->second.reason); | 515 entry_dict->SetInteger("reason", it->second.reason); |
516 entry_list->Append(entry_dict.Pass()); | 516 entry_list->Append(entry_dict.Pass()); |
517 } | 517 } |
518 value->Set("blacklisted", entry_list.Pass()); | 518 value->Set("blacklisted", entry_list.Pass()); |
519 | 519 |
520 return value.Pass(); | 520 return value.Pass(); |
521 } | 521 } |
522 | 522 |
523 } // namespace net | 523 } // namespace net |
OLD | NEW |