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 #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 Loading... |
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 Loading... |
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_ |
OLD | NEW |