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

Side by Side Diff: url/gurl.cc

Issue 2686853004: Move IsAboutBlank from url_utils to GURL (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « url/gurl.h ('k') | url/gurl_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 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
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()) {
brettw 2017/02/09 20:30:28 Remove {} for consistency.
clamy 2017/02/10 13:17:22 Done.
356 return false;
357 }
358
359 if (path() != url::kAboutBlankPath && path() != url::kAboutBlankWithHashPath)
360 return false;
361
362 return true;
363 }
364
351 bool GURL::SchemeIs(base::StringPiece lower_ascii_scheme) const { 365 bool GURL::SchemeIs(base::StringPiece lower_ascii_scheme) const {
352 DCHECK(base::IsStringASCII(lower_ascii_scheme)); 366 DCHECK(base::IsStringASCII(lower_ascii_scheme));
353 DCHECK(base::ToLowerASCII(lower_ascii_scheme) == lower_ascii_scheme); 367 DCHECK(base::ToLowerASCII(lower_ascii_scheme) == lower_ascii_scheme);
354 368
355 if (parsed_.scheme.len <= 0) 369 if (parsed_.scheme.len <= 0)
356 return lower_ascii_scheme.empty(); 370 return lower_ascii_scheme.empty();
357 return scheme_piece() == lower_ascii_scheme; 371 return scheme_piece() == lower_ascii_scheme;
358 } 372 }
359 373
360 bool GURL::SchemeIsHTTPOrHTTPS() const { 374 bool GURL::SchemeIsHTTPOrHTTPS() const {
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 516 }
503 517
504 bool operator==(const GURL& x, const base::StringPiece& spec) { 518 bool operator==(const GURL& x, const base::StringPiece& spec) {
505 DCHECK_EQ(GURL(spec).possibly_invalid_spec(), spec); 519 DCHECK_EQ(GURL(spec).possibly_invalid_spec(), spec);
506 return x.possibly_invalid_spec() == spec; 520 return x.possibly_invalid_spec() == spec;
507 } 521 }
508 522
509 bool operator!=(const GURL& x, const base::StringPiece& spec) { 523 bool operator!=(const GURL& x, const base::StringPiece& spec) {
510 return !(x == spec); 524 return !(x == spec);
511 } 525 }
OLDNEW
« no previous file with comments | « url/gurl.h ('k') | url/gurl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698