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

Side by Side Diff: url/gurl.h

Issue 301353003: Using pre-existing constants instead of hard-coding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 | « no previous file | 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 <iosfwd> 8 #include <iosfwd>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "url/url_canon.h" 13 #include "url/url_canon.h"
14 #include "url/url_canon_stdstring.h" 14 #include "url/url_canon_stdstring.h"
15 #include "url/url_constants.h"
15 #include "url/url_export.h" 16 #include "url/url_export.h"
16 #include "url/url_parse.h" 17 #include "url/url_parse.h"
17 18
18 class URL_EXPORT GURL { 19 class URL_EXPORT GURL {
19 public: 20 public:
20 typedef url::StdStringReplacements<std::string> Replacements; 21 typedef url::StdStringReplacements<std::string> Replacements;
21 typedef url::StdStringReplacements<base::string16> ReplacementsW; 22 typedef url::StdStringReplacements<base::string16> ReplacementsW;
22 23
23 // Creates an empty, invalid URL. 24 // Creates an empty, invalid URL.
24 GURL(); 25 GURL();
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return SchemeIs("file"); 225 return SchemeIs("file");
225 } 226 }
226 227
227 // FileSystem URLs need to be treated differently in some cases. 228 // FileSystem URLs need to be treated differently in some cases.
228 bool SchemeIsFileSystem() const { 229 bool SchemeIsFileSystem() const {
229 return SchemeIs("filesystem"); 230 return SchemeIs("filesystem");
230 } 231 }
231 232
232 // If the scheme indicates a secure connection 233 // If the scheme indicates a secure connection
233 bool SchemeIsSecure() const { 234 bool SchemeIsSecure() const {
234 return SchemeIs("https") || SchemeIs("wss") || 235 return SchemeIs(url::kHttpsScheme) || SchemeIs(kWssScheme) ||
brettw 2014/05/30 17:36:28 need url:: on the WssScheme
235 (SchemeIsFileSystem() && inner_url() && inner_url()->SchemeIsSecure()); 236 (SchemeIsFileSystem() && inner_url() && inner_url()->SchemeIsSecure());
236 } 237 }
237 238
238 // The "content" of the URL is everything after the scheme (skipping the 239 // The "content" of the URL is everything after the scheme (skipping the
239 // scheme delimiting colon). It is an error to get the origin of an invalid 240 // scheme delimiting colon). It is an error to get the origin of an invalid
240 // URL. The result will be an empty string. 241 // URL. The result will be an empty string.
241 std::string GetContent() const; 242 std::string GetContent() const;
242 243
243 // Returns true if the hostname is an IP address. Note: this function isn't 244 // Returns true if the hostname is an IP address. Note: this function isn't
244 // as cheap as a simple getter because it re-parses the hostname to verify. 245 // as cheap as a simple getter because it re-parses the hostname to verify.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 // Used for nested schemes [currently only filesystem:]. 398 // Used for nested schemes [currently only filesystem:].
398 scoped_ptr<GURL> inner_url_; 399 scoped_ptr<GURL> inner_url_;
399 400
400 // TODO bug 684583: Add encoding for query params. 401 // TODO bug 684583: Add encoding for query params.
401 }; 402 };
402 403
403 // Stream operator so GURL can be used in assertion statements. 404 // Stream operator so GURL can be used in assertion statements.
404 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); 405 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url);
405 406
406 #endif // URL_GURL_H_ 407 #endif // URL_GURL_H_
OLDNEW
« no previous file with comments | « no previous file | url/gurl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698