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

Side by Side Diff: url/gurl.h

Issue 2956643002: Add GURL::HostNoBracketsPiece() (Closed)
Patch Set: Simplify test Created 3 years, 5 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 | « net/url_request/url_request_http_job.cc ('k') | url/gurl.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 #ifndef URL_GURL_H_ 5 #ifndef URL_GURL_H_
6 #define URL_GURL_H_ 6 #define URL_GURL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <iosfwd> 10 #include <iosfwd>
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 std::string ExtractFileName() const; 373 std::string ExtractFileName() const;
374 374
375 // Returns the path that should be sent to the server. This is the path, 375 // Returns the path that should be sent to the server. This is the path,
376 // parameter, and query portions of the URL. It is guaranteed to be ASCII. 376 // parameter, and query portions of the URL. It is guaranteed to be ASCII.
377 std::string PathForRequest() const; 377 std::string PathForRequest() const;
378 378
379 // Returns the host, excluding the square brackets surrounding IPv6 address 379 // Returns the host, excluding the square brackets surrounding IPv6 address
380 // literals. This can be useful for passing to getaddrinfo(). 380 // literals. This can be useful for passing to getaddrinfo().
381 std::string HostNoBrackets() const; 381 std::string HostNoBrackets() const;
382 382
383 // Returns the same characters as HostNoBrackets(), avoiding a copy.
384 base::StringPiece HostNoBracketsPiece() const;
385
383 // Returns true if this URL's host matches or is in the same domain as 386 // Returns true if this URL's host matches or is in the same domain as
384 // the given input string. For example, if the hostname of the URL is 387 // the given input string. For example, if the hostname of the URL is
385 // "www.google.com", this will return true for "com", "google.com", and 388 // "www.google.com", this will return true for "com", "google.com", and
386 // "www.google.com". 389 // "www.google.com".
387 // 390 //
388 // The input domain should be lower-case ASCII to match the canonicalized 391 // The input domain should be lower-case ASCII to match the canonicalized
389 // scheme. This call is more efficient than getting the host and check 392 // scheme. This call is more efficient than getting the host and check
390 // whether host has the specific domain or not because no copies or 393 // whether host has the specific domain or not because no copies or
391 // object constructions are done. 394 // object constructions are done.
392 bool DomainIs(base::StringPiece lower_ascii_domain) const; 395 bool DomainIs(base::StringPiece lower_ascii_domain) const;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 URL_EXPORT bool operator==(const GURL& x, const GURL& y); 470 URL_EXPORT bool operator==(const GURL& x, const GURL& y);
468 URL_EXPORT bool operator!=(const GURL& x, const GURL& y); 471 URL_EXPORT bool operator!=(const GURL& x, const GURL& y);
469 472
470 // Equality operator for comparing raw spec_. This should be used in place of 473 // Equality operator for comparing raw spec_. This should be used in place of
471 // url == GURL(spec) where |spec| is known (i.e. constants). This is to prevent 474 // url == GURL(spec) where |spec| is known (i.e. constants). This is to prevent
472 // needlessly re-parsing |spec| into a temporary GURL. 475 // needlessly re-parsing |spec| into a temporary GURL.
473 URL_EXPORT bool operator==(const GURL& x, const base::StringPiece& spec); 476 URL_EXPORT bool operator==(const GURL& x, const base::StringPiece& spec);
474 URL_EXPORT bool operator!=(const GURL& x, const base::StringPiece& spec); 477 URL_EXPORT bool operator!=(const GURL& x, const base::StringPiece& spec);
475 478
476 #endif // URL_GURL_H_ 479 #endif // URL_GURL_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request_http_job.cc ('k') | url/gurl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698