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

Side by Side Diff: url/gurl.h

Issue 335353002: Replace some hard coded schemes with the constants in /url/url_constants.h. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typos. 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
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 // Returns true if the scheme is "http" or "https". 216 // Returns true if the scheme is "http" or "https".
217 bool SchemeIsHTTPOrHTTPS() const; 217 bool SchemeIsHTTPOrHTTPS() const;
218 218
219 // Returns true is the scheme is "ws" or "wss". 219 // Returns true is the scheme is "ws" or "wss".
220 bool SchemeIsWSOrWSS() const; 220 bool SchemeIsWSOrWSS() const;
221 221
222 // We often need to know if this is a file URL. File URLs are "standard", but 222 // We often need to know if this is a file URL. File URLs are "standard", but
223 // are often treated separately by some programs. 223 // are often treated separately by some programs.
224 bool SchemeIsFile() const { 224 bool SchemeIsFile() const {
225 return SchemeIs("file"); 225 return SchemeIs(url::kFileScheme);
226 } 226 }
227 227
228 // FileSystem URLs need to be treated differently in some cases. 228 // FileSystem URLs need to be treated differently in some cases.
229 bool SchemeIsFileSystem() const { 229 bool SchemeIsFileSystem() const {
230 return SchemeIs("filesystem"); 230 return SchemeIs(url::kFileSystemScheme);
231 } 231 }
232 232
233 // If the scheme indicates a secure connection 233 // If the scheme indicates a secure connection
234 bool SchemeIsSecure() const { 234 bool SchemeIsSecure() const {
235 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme) || 235 return SchemeIs(url::kHttpsScheme) || SchemeIs(url::kWssScheme) ||
236 (SchemeIsFileSystem() && inner_url() && inner_url()->SchemeIsSecure()); 236 (SchemeIsFileSystem() && inner_url() && inner_url()->SchemeIsSecure());
237 } 237 }
238 238
239 // 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
240 // 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
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // Used for nested schemes [currently only filesystem:]. 398 // Used for nested schemes [currently only filesystem:].
399 scoped_ptr<GURL> inner_url_; 399 scoped_ptr<GURL> inner_url_;
400 400
401 // TODO bug 684583: Add encoding for query params. 401 // TODO bug 684583: Add encoding for query params.
402 }; 402 };
403 403
404 // Stream operator so GURL can be used in assertion statements. 404 // Stream operator so GURL can be used in assertion statements.
405 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url); 405 URL_EXPORT std::ostream& operator<<(std::ostream& out, const GURL& url);
406 406
407 #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