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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 replacements.ClearUsername(); | 315 replacements.ClearUsername(); |
316 replacements.ClearPassword(); | 316 replacements.ClearPassword(); |
317 replacements.ClearPath(); | 317 replacements.ClearPath(); |
318 replacements.ClearQuery(); | 318 replacements.ClearQuery(); |
319 replacements.ClearRef(); | 319 replacements.ClearRef(); |
320 | 320 |
321 return ReplaceComponents(replacements); | 321 return ReplaceComponents(replacements); |
322 } | 322 } |
323 | 323 |
324 GURL GURL::GetAsReferrer() const { | 324 GURL GURL::GetAsReferrer() const { |
325 if (!is_valid_ || | 325 if (!is_valid_ || !SchemeIsHTTPOrHTTPS()) |
326 (!has_ref() && !has_username() && !has_password())) | 326 return GURL(); |
| 327 |
| 328 if (!has_ref() && !has_username() && !has_password()) |
327 return GURL(*this); | 329 return GURL(*this); |
328 | 330 |
329 url::Replacements<char> replacements; | 331 url::Replacements<char> replacements; |
330 replacements.ClearRef(); | 332 replacements.ClearRef(); |
331 replacements.ClearUsername(); | 333 replacements.ClearUsername(); |
332 replacements.ClearPassword(); | 334 replacements.ClearPassword(); |
333 return ReplaceComponents(replacements); | 335 return ReplaceComponents(replacements); |
334 } | 336 } |
335 | 337 |
336 GURL GURL::GetWithEmptyPath() const { | 338 GURL GURL::GetWithEmptyPath() const { |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 void GURL::Swap(GURL* other) { | 524 void GURL::Swap(GURL* other) { |
523 spec_.swap(other->spec_); | 525 spec_.swap(other->spec_); |
524 std::swap(is_valid_, other->is_valid_); | 526 std::swap(is_valid_, other->is_valid_); |
525 std::swap(parsed_, other->parsed_); | 527 std::swap(parsed_, other->parsed_); |
526 inner_url_.swap(other->inner_url_); | 528 inner_url_.swap(other->inner_url_); |
527 } | 529 } |
528 | 530 |
529 std::ostream& operator<<(std::ostream& out, const GURL& url) { | 531 std::ostream& operator<<(std::ostream& out, const GURL& url) { |
530 return out << url.possibly_invalid_spec(); | 532 return out << url.possibly_invalid_spec(); |
531 } | 533 } |
OLD | NEW |