OLD | NEW |
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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 NET_QUIC_PLATFORM_IMPL_QUIC_URL_IMPL_H_ | 5 #ifndef NET_QUIC_PLATFORM_IMPL_QUIC_URL_IMPL_H_ |
6 #define NET_QUIC_PLATFORM_IMPL_QUIC_URL_IMPL_H_ | 6 #define NET_QUIC_PLATFORM_IMPL_QUIC_URL_IMPL_H_ |
7 | 7 |
8 #include "net/quic/platform/api/quic_export.h" | 8 #include "net/quic/platform/api/quic_export.h" |
| 9 #include "net/quic/platform/api/quic_string_piece.h" |
9 #include "url/gurl.h" | 10 #include "url/gurl.h" |
10 | 11 |
11 namespace net { | 12 namespace net { |
12 | 13 |
13 class QUIC_EXPORT_PRIVATE QuicUrlImpl { | 14 class QUIC_EXPORT_PRIVATE QuicUrlImpl { |
14 public: | 15 public: |
15 static const size_t kMaxHostNameLength = 256; | 16 static const size_t kMaxHostNameLength = 256; |
16 | 17 |
17 // Constructs an empty QuicUrl. | 18 // Constructs an empty QuicUrl. |
18 QuicUrlImpl() = default; | 19 QuicUrlImpl() = default; |
19 | 20 |
20 // Constructs a QuicUrlImpl from the url string |url|. | 21 // Constructs a QuicUrlImpl from the url string |url|. |
21 // NOTE: If |url| doesn't have a scheme, it will have an empty scheme | 22 // NOTE: If |url| doesn't have a scheme, it will have an empty scheme |
22 // field. If that's not what you want, use the QuicUrlImpl(url, | 23 // field. If that's not what you want, use the QuicUrlImpl(url, |
23 // default_scheme) form below. | 24 // default_scheme) form below. |
24 explicit QuicUrlImpl(base::StringPiece url); | 25 explicit QuicUrlImpl(QuicStringPiece url); |
25 | 26 |
26 // Constructs a QuicUrlImpl from |url|, assuming that the scheme for the URL | 27 // Constructs a QuicUrlImpl from |url|, assuming that the scheme for the URL |
27 // is |default_scheme| if there is no scheme specified in |url|. | 28 // is |default_scheme| if there is no scheme specified in |url|. |
28 QuicUrlImpl(base::StringPiece url, base::StringPiece default_scheme); | 29 QuicUrlImpl(QuicStringPiece url, QuicStringPiece default_scheme); |
29 | 30 |
30 QuicUrlImpl(const QuicUrlImpl& url); | 31 QuicUrlImpl(const QuicUrlImpl& url); |
31 | 32 |
32 // Returns false if any of these conditions occur: | 33 // Returns false if any of these conditions occur: |
33 // No scheme specified | 34 // No scheme specified |
34 // Host name too long (> 256 bytes) | 35 // Host name too long (> 256 bytes) |
35 // Invalid characters in host name, path or params | 36 // Invalid characters in host name, path or params |
36 // Invalid port number (e.g. greater than 65535) | 37 // Invalid port number (e.g. greater than 65535) |
37 bool IsValid() const; | 38 bool IsValid() const; |
38 | 39 |
(...skipping 18 matching lines...) Expand all Loading... |
57 | 58 |
58 const GURL& url() const { return url_; } | 59 const GURL& url() const { return url_; } |
59 | 60 |
60 private: | 61 private: |
61 GURL url_; | 62 GURL url_; |
62 }; | 63 }; |
63 | 64 |
64 } // namespace net | 65 } // namespace net |
65 | 66 |
66 #endif // NET_QUIC_PLATFORM_IMPL_QUIC_URL_IMPL_H_ | 67 #endif // NET_QUIC_PLATFORM_IMPL_QUIC_URL_IMPL_H_ |
OLD | NEW |