Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: url/gurl.cc

Issue 23549039: Preparing to support fragment resolution against non-hierarchical schemes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « url/gurl.h ('k') | url/third_party/mozilla/url_parse.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « url/gurl.h ('k') | url/third_party/mozilla/url_parse.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698