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