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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 } | 360 } |
361 | 361 |
362 bool GURL::SchemeIs(const char* lower_ascii_scheme) const { | 362 bool GURL::SchemeIs(const char* lower_ascii_scheme) const { |
363 if (parsed_.scheme.len <= 0) | 363 if (parsed_.scheme.len <= 0) |
364 return lower_ascii_scheme == NULL; | 364 return lower_ascii_scheme == NULL; |
365 return url_util::LowerCaseEqualsASCII(spec_.data() + parsed_.scheme.begin, | 365 return url_util::LowerCaseEqualsASCII(spec_.data() + parsed_.scheme.begin, |
366 spec_.data() + parsed_.scheme.end(), | 366 spec_.data() + parsed_.scheme.end(), |
367 lower_ascii_scheme); | 367 lower_ascii_scheme); |
368 } | 368 } |
369 | 369 |
| 370 bool GURL::SchemeIsHTTPOrHTTPS() const { |
| 371 return SchemeIs("http") || SchemeIs("https"); |
| 372 } |
| 373 |
370 int GURL::IntPort() const { | 374 int GURL::IntPort() const { |
371 if (parsed_.port.is_nonempty()) | 375 if (parsed_.port.is_nonempty()) |
372 return url_parse::ParsePort(spec_.data(), parsed_.port); | 376 return url_parse::ParsePort(spec_.data(), parsed_.port); |
373 return url_parse::PORT_UNSPECIFIED; | 377 return url_parse::PORT_UNSPECIFIED; |
374 } | 378 } |
375 | 379 |
376 int GURL::EffectiveIntPort() const { | 380 int GURL::EffectiveIntPort() const { |
377 int int_port = IntPort(); | 381 int int_port = IntPort(); |
378 if (int_port == url_parse::PORT_UNSPECIFIED && IsStandard()) | 382 if (int_port == url_parse::PORT_UNSPECIFIED && IsStandard()) |
379 return url_canon::DefaultPortForScheme(spec_.data() + parsed_.scheme.begin, | 383 return url_canon::DefaultPortForScheme(spec_.data() + parsed_.scheme.begin, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 void GURL::Swap(GURL* other) { | 512 void GURL::Swap(GURL* other) { |
509 spec_.swap(other->spec_); | 513 spec_.swap(other->spec_); |
510 std::swap(is_valid_, other->is_valid_); | 514 std::swap(is_valid_, other->is_valid_); |
511 std::swap(parsed_, other->parsed_); | 515 std::swap(parsed_, other->parsed_); |
512 std::swap(inner_url_, other->inner_url_); | 516 std::swap(inner_url_, other->inner_url_); |
513 } | 517 } |
514 | 518 |
515 std::ostream& operator<<(std::ostream& out, const GURL& url) { | 519 std::ostream& operator<<(std::ostream& out, const GURL& url) { |
516 return out << url.possibly_invalid_spec(); | 520 return out << url.possibly_invalid_spec(); |
517 } | 521 } |
OLD | NEW |