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

Side by Side Diff: src/gurl.cc

Issue 8974033: Fix the GURL change [compile error, two small changes to make things safe while (Closed) Base URL: http://google-url.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 11 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 | « no previous file | src/url_canon_unittest.cc » ('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 2007, Google Inc. 1 // Copyright 2007, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 449
450 #endif // WIN32 450 #endif // WIN32
451 451
452 bool GURL::DomainIs(const char* lower_ascii_domain, 452 bool GURL::DomainIs(const char* lower_ascii_domain,
453 int domain_len) const { 453 int domain_len) const {
454 // Return false if this URL is not valid or domain is empty. 454 // Return false if this URL is not valid or domain is empty.
455 if (!is_valid_ || !domain_len) 455 if (!is_valid_ || !domain_len)
456 return false; 456 return false;
457 457
458 // FileSystem URLs have empty parsed_.host, so check this first. 458 // FileSystem URLs have empty parsed_.host, so check this first.
459 if (SchemeIsFileSystem()) 459 if (SchemeIsFileSystem() && inner_url_)
460 return inner_url_->DomainIs(lower_ascii_domain, domain_len); 460 return inner_url_->DomainIs(lower_ascii_domain, domain_len);
461 461
462 if (!parsed_.host.is_nonempty()) 462 if (!parsed_.host.is_nonempty())
463 return false; 463 return false;
464 464
465 // Check whether the host name is end with a dot. If yes, treat it 465 // Check whether the host name is end with a dot. If yes, treat it
466 // the same as no-dot unless the input comparison domain is end 466 // the same as no-dot unless the input comparison domain is end
467 // with dot. 467 // with dot.
468 const char* last_pos = spec_.data() + parsed_.host.end() - 1; 468 const char* last_pos = spec_.data() + parsed_.host.end() - 1;
469 int host_len = parsed_.host.len; 469 int host_len = parsed_.host.len;
(...skipping 29 matching lines...) Expand all
499 void GURL::Swap(GURL* other) { 499 void GURL::Swap(GURL* other) {
500 spec_.swap(other->spec_); 500 spec_.swap(other->spec_);
501 std::swap(is_valid_, other->is_valid_); 501 std::swap(is_valid_, other->is_valid_);
502 std::swap(parsed_, other->parsed_); 502 std::swap(parsed_, other->parsed_);
503 std::swap(inner_url_, other->inner_url_); 503 std::swap(inner_url_, other->inner_url_);
504 } 504 }
505 505
506 std::ostream& operator<<(std::ostream& out, const GURL& url) { 506 std::ostream& operator<<(std::ostream& out, const GURL& url) {
507 return out << url.possibly_invalid_spec(); 507 return out << url.possibly_invalid_spec();
508 } 508 }
OLDNEW
« no previous file with comments | « no previous file | src/url_canon_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698