| 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 #include "url/gurl.h" | 5 #include "url/gurl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <ostream> | 10 #include <ostream> |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 other.spec_[other.parsed_.path.begin] = '/'; | 341 other.spec_[other.parsed_.path.begin] = '/'; |
| 342 other.parsed_.path.len = 1; | 342 other.parsed_.path.len = 1; |
| 343 other.spec_.resize(other.parsed_.path.begin + 1); | 343 other.spec_.resize(other.parsed_.path.begin + 1); |
| 344 return other; | 344 return other; |
| 345 } | 345 } |
| 346 | 346 |
| 347 bool GURL::IsStandard() const { | 347 bool GURL::IsStandard() const { |
| 348 return url::IsStandard(spec_.data(), parsed_.scheme); | 348 return url::IsStandard(spec_.data(), parsed_.scheme); |
| 349 } | 349 } |
| 350 | 350 |
| 351 bool GURL::IsAboutBlank() const { |
| 352 if (!SchemeIs(url::kAboutScheme)) |
| 353 return false; |
| 354 |
| 355 if (has_host() || has_username() || has_password() || has_port()) |
| 356 return false; |
| 357 |
| 358 if (path() != url::kAboutBlankPath && path() != url::kAboutBlankWithHashPath) |
| 359 return false; |
| 360 |
| 361 return true; |
| 362 } |
| 363 |
| 351 bool GURL::SchemeIs(base::StringPiece lower_ascii_scheme) const { | 364 bool GURL::SchemeIs(base::StringPiece lower_ascii_scheme) const { |
| 352 DCHECK(base::IsStringASCII(lower_ascii_scheme)); | 365 DCHECK(base::IsStringASCII(lower_ascii_scheme)); |
| 353 DCHECK(base::ToLowerASCII(lower_ascii_scheme) == lower_ascii_scheme); | 366 DCHECK(base::ToLowerASCII(lower_ascii_scheme) == lower_ascii_scheme); |
| 354 | 367 |
| 355 if (parsed_.scheme.len <= 0) | 368 if (parsed_.scheme.len <= 0) |
| 356 return lower_ascii_scheme.empty(); | 369 return lower_ascii_scheme.empty(); |
| 357 return scheme_piece() == lower_ascii_scheme; | 370 return scheme_piece() == lower_ascii_scheme; |
| 358 } | 371 } |
| 359 | 372 |
| 360 bool GURL::SchemeIsHTTPOrHTTPS() const { | 373 bool GURL::SchemeIsHTTPOrHTTPS() const { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 } | 515 } |
| 503 | 516 |
| 504 bool operator==(const GURL& x, const base::StringPiece& spec) { | 517 bool operator==(const GURL& x, const base::StringPiece& spec) { |
| 505 DCHECK_EQ(GURL(spec).possibly_invalid_spec(), spec); | 518 DCHECK_EQ(GURL(spec).possibly_invalid_spec(), spec); |
| 506 return x.possibly_invalid_spec() == spec; | 519 return x.possibly_invalid_spec() == spec; |
| 507 } | 520 } |
| 508 | 521 |
| 509 bool operator!=(const GURL& x, const base::StringPiece& spec) { | 522 bool operator!=(const GURL& x, const base::StringPiece& spec) { |
| 510 return !(x == spec); | 523 return !(x == spec); |
| 511 } | 524 } |
| OLD | NEW |