OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008, 2009, 2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2008, 2009, 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 14 matching lines...) Expand all Loading... |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef KURLGooglePrivate_h | 31 #ifndef KURLGooglePrivate_h |
32 #define KURLGooglePrivate_h | 32 #define KURLGooglePrivate_h |
33 | 33 |
34 #include <wtf/text/CString.h> | 34 #include <wtf/text/CString.h> |
| 35 #include <wtf/OwnPtr.h> |
35 | 36 |
36 #include <googleurl/src/url_parse.h> | 37 #include <googleurl/src/url_parse.h> |
37 #include <googleurl/src/url_canon.h> | 38 #include <googleurl/src/url_canon.h> |
38 | 39 |
39 namespace WebCore { | 40 namespace WebCore { |
40 | 41 |
41 class KURL; | 42 class KURL; |
42 class TextEncoding; | 43 class TextEncoding; |
43 | 44 |
44 // Wraps the internals related to using Google-URL as the backend for KURL. | 45 // Wraps the internals related to using Google-URL as the backend for KURL. |
45 // This maintains the state and has auxiliary functions so that we don't nee
d | 46 // This maintains the state and has auxiliary functions so that we don't nee
d |
46 // to uglify KURL.h while allowing Google-URL to be evaluated. | 47 // to uglify KURL.h while allowing Google-URL to be evaluated. |
47 class KURLGooglePrivate { | 48 class KURLGooglePrivate { |
48 public: | 49 public: |
49 KURLGooglePrivate(); | 50 KURLGooglePrivate(); |
50 KURLGooglePrivate(const url_parse::Parsed&, bool isValid); | 51 KURLGooglePrivate(const url_parse::Parsed&, bool isValid); |
51 KURLGooglePrivate(WTF::HashTableDeletedValueType); | 52 KURLGooglePrivate(WTF::HashTableDeletedValueType); |
| 53 KURLGooglePrivate(const KURLGooglePrivate&); |
| 54 KURLGooglePrivate& operator=(const KURLGooglePrivate&); |
52 | 55 |
53 // Initializes the object. This will call through the backend initialize
r | 56 // Initializes the object. This will call through the backend initialize
r |
54 // below. | 57 // below. |
55 void init(const KURL& base, const String& relative, | 58 void init(const KURL& base, const String& relative, |
56 const TextEncoding* queryEncoding); | 59 const TextEncoding* queryEncoding); |
57 | 60 |
58 // Backend initializer. The query encoding parameters are optional and c
an | 61 // Backend initializer. The query encoding parameters are optional and c
an |
59 // be 0 (this implies UTF-8). This initializer requires that the object | 62 // be 0 (this implies UTF-8). This initializer requires that the object |
60 // has just been created and the strings are null. Do not call on an | 63 // has just been created and the strings are null. Do not call on an |
61 // already-constructed object. | 64 // already-constructed object. |
(...skipping 25 matching lines...) Expand all Loading... |
87 // to share a buffer internally, and saves a malloc. | 90 // to share a buffer internally, and saves a malloc. |
88 | 91 |
89 // Getters for the data. | 92 // Getters for the data. |
90 const CString& utf8String() const { return m_utf8; } | 93 const CString& utf8String() const { return m_utf8; } |
91 const String& string() const; | 94 const String& string() const; |
92 | 95 |
93 bool m_isValid; | 96 bool m_isValid; |
94 bool m_protocolIsInHTTPFamily; | 97 bool m_protocolIsInHTTPFamily; |
95 url_parse::Parsed m_parsed; // Indexes into the UTF-8 version of the str
ing. | 98 url_parse::Parsed m_parsed; // Indexes into the UTF-8 version of the str
ing. |
96 | 99 |
| 100 KURL* innerURL() const { return m_innerURL.get(); } |
| 101 |
97 private: | 102 private: |
| 103 void initInnerURL(); |
98 void initProtocolIsInHTTPFamily(); | 104 void initProtocolIsInHTTPFamily(); |
99 | 105 |
100 CString m_utf8; | 106 CString m_utf8; |
101 | 107 |
102 // Set to true when the caller set us using the ASCII setter. We can | 108 // Set to true when the caller set us using the ASCII setter. We can |
103 // be more efficient when we know there is no UTF-8 to worry about. | 109 // be more efficient when we know there is no UTF-8 to worry about. |
104 // This flag is currently always correct, but should be changed to be a | 110 // This flag is currently always correct, but should be changed to be a |
105 // hint (see setUtf8). | 111 // hint (see setUtf8). |
106 bool m_utf8IsASCII; | 112 bool m_utf8IsASCII; |
107 | 113 |
108 mutable bool m_stringIsValid; | 114 mutable bool m_stringIsValid; |
109 mutable String m_string; | 115 mutable String m_string; |
| 116 |
| 117 OwnPtr<KURL> m_innerURL; |
110 }; | 118 }; |
111 | 119 |
112 } // namespace WebCore | 120 } // namespace WebCore |
113 | 121 |
114 #endif | 122 #endif |
OLD | NEW |