Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifdef WIN32 | 5 #ifdef WIN32 |
| 6 #include <windows.h> | 6 #include <windows.h> |
| 7 #else | 7 #else |
| 8 #include <pthread.h> | 8 #include <pthread.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 std::string GURL::HostNoBrackets() const { | 412 std::string GURL::HostNoBrackets() const { |
| 413 // If host looks like an IPv6 literal, strip the square brackets. | 413 // If host looks like an IPv6 literal, strip the square brackets. |
| 414 url_parse::Component h(parsed_.host); | 414 url_parse::Component h(parsed_.host); |
| 415 if (h.len >= 2 && spec_[h.begin] == '[' && spec_[h.end() - 1] == ']') { | 415 if (h.len >= 2 && spec_[h.begin] == '[' && spec_[h.end() - 1] == ']') { |
| 416 h.begin++; | 416 h.begin++; |
| 417 h.len -= 2; | 417 h.len -= 2; |
| 418 } | 418 } |
| 419 return ComponentString(h); | 419 return ComponentString(h); |
| 420 } | 420 } |
| 421 | 421 |
| 422 std::string GURL::GetContent() const { | |
| 423 return ComponentString(parsed_.GetContent()); | |
|
joth
2013/09/20 18:08:16
return is_valid_ ? ComponentString(parsed_.GetCont
Kristian Monsen
2013/09/20 21:59:04
Done.
| |
| 424 } | |
| 425 | |
| 422 bool GURL::HostIsIPAddress() const { | 426 bool GURL::HostIsIPAddress() const { |
| 423 if (!is_valid_ || spec_.empty()) | 427 if (!is_valid_ || spec_.empty()) |
| 424 return false; | 428 return false; |
| 425 | 429 |
| 426 url_canon::RawCanonOutputT<char, 128> ignored_output; | 430 url_canon::RawCanonOutputT<char, 128> ignored_output; |
| 427 url_canon::CanonHostInfo host_info; | 431 url_canon::CanonHostInfo host_info; |
| 428 url_canon::CanonicalizeIPAddress(spec_.c_str(), parsed_.host, | 432 url_canon::CanonicalizeIPAddress(spec_.c_str(), parsed_.host, |
| 429 &ignored_output, &host_info); | 433 &ignored_output, &host_info); |
| 430 return host_info.IsIPAddress(); | 434 return host_info.IsIPAddress(); |
| 431 } | 435 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 void GURL::Swap(GURL* other) { | 516 void GURL::Swap(GURL* other) { |
| 513 spec_.swap(other->spec_); | 517 spec_.swap(other->spec_); |
| 514 std::swap(is_valid_, other->is_valid_); | 518 std::swap(is_valid_, other->is_valid_); |
| 515 std::swap(parsed_, other->parsed_); | 519 std::swap(parsed_, other->parsed_); |
| 516 std::swap(inner_url_, other->inner_url_); | 520 std::swap(inner_url_, other->inner_url_); |
| 517 } | 521 } |
| 518 | 522 |
| 519 std::ostream& operator<<(std::ostream& out, const GURL& url) { | 523 std::ostream& operator<<(std::ostream& out, const GURL& url) { |
| 520 return out << url.possibly_invalid_spec(); | 524 return out << url.possibly_invalid_spec(); |
| 521 } | 525 } |
| OLD | NEW |