Chromium Code Reviews| Index: public/platform/WebURL.h |
| diff --git a/public/platform/WebURL.h b/public/platform/WebURL.h |
| index 5f47dc30fd0b0f2e7ff4de126085295a7490588b..4a140c5026f8502061bafa50e2e1595e904d15d7 100644 |
| --- a/public/platform/WebURL.h |
| +++ b/public/platform/WebURL.h |
| @@ -32,6 +32,7 @@ |
| #define WebURL_h |
| #include "WebCString.h" |
| +#include "WebString.h" |
| #include <url/url_parse.h> |
| #if WEBKIT_IMPLEMENTATION |
| @@ -48,42 +49,34 @@ public: |
| { |
| } |
| - WebURL() : m_isValid(false) |
| + WebURL() |
| + : m_isValid(false) |
| { |
| } |
| - WebURL(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid) |
| - : m_spec(spec) |
| - , m_parsed(parsed) |
| - , m_isValid(isValid) |
| + WebURL(const WebURL& url) |
| + : m_string(url.m_string) |
| + , m_parsed(url.m_parsed) |
| + , m_isValid(url.m_isValid) |
| { |
| } |
| - WebURL(const WebURL& s) |
| - : m_spec(s.m_spec) |
| - , m_parsed(s.m_parsed) |
| - , m_isValid(s.m_isValid) |
| + WebURL& operator=(const WebURL& url) |
| { |
| - } |
| - |
| - WebURL& operator=(const WebURL& s) |
| - { |
| - m_spec = s.m_spec; |
| - m_parsed = s.m_parsed; |
| - m_isValid = s.m_isValid; |
| + m_string = url.m_string; |
| + m_parsed = url.m_parsed; |
| + m_isValid = url.m_isValid; |
| return *this; |
| } |
| - void assign(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid) |
| + WebCString spec() const |
| { |
| - m_spec = spec; |
| - m_parsed = parsed; |
| - m_isValid = isValid; |
| + return m_string.utf8(); |
| } |
| - const WebCString& spec() const |
| + const WebString& string() const |
| { |
| - return m_spec; |
| + return m_string; |
| } |
| const url_parse::Parsed& parsed() const |
| @@ -98,12 +91,12 @@ public: |
| bool isEmpty() const |
| { |
| - return m_spec.isEmpty(); |
| + return m_string.isEmpty(); |
| } |
| bool isNull() const |
| { |
| - return m_spec.isEmpty(); |
| + return m_string.isEmpty(); |
| } |
| #if WEBKIT_IMPLEMENTATION |
| @@ -111,41 +104,41 @@ public: |
| WebURL& operator=(const WebCore::KURL&); |
| operator WebCore::KURL() const; |
| #else |
| - WebURL(const GURL& g) |
| - : m_spec(g.possibly_invalid_spec()) |
| - , m_parsed(g.parsed_for_possibly_invalid_spec()) |
| - , m_isValid(g.is_valid()) |
| + WebURL(const GURL& url) |
| + : m_string(WebString::fromUTF8(url.possibly_invalid_spec())) |
| + , m_parsed(url.parsed_for_possibly_invalid_spec()) |
| + , m_isValid(url.is_valid()) |
| { |
| } |
| - WebURL& operator=(const GURL& g) |
| + WebURL& operator=(const GURL& url) |
| { |
| - m_spec = g.possibly_invalid_spec(); |
| - m_parsed = g.parsed_for_possibly_invalid_spec(); |
| - m_isValid = g.is_valid(); |
| + m_string = WebString::fromUTF8(url.possibly_invalid_spec()); |
| + m_parsed = url.parsed_for_possibly_invalid_spec(); |
| + m_isValid = url.is_valid(); |
| return *this; |
| } |
| operator GURL() const |
| { |
| - return isNull() ? GURL() : GURL(m_spec.data(), m_spec.length(), m_parsed, m_isValid); |
| + return isNull() ? GURL() : GURL(m_string.toUTF8String(), m_parsed, m_isValid); |
|
Jeffrey Yasskin
2013/07/24 21:23:51
In order to avoid a copy here, you need to use a G
abarth-chromium
2013/07/24 21:57:34
Sorry for not cross-linking the CLs. The CL that
|
| } |
| #endif |
| private: |
| - WebCString m_spec; // UTF-8 encoded |
| + WebString m_string; |
| url_parse::Parsed m_parsed; |
| bool m_isValid; |
| }; |
| inline bool operator<(const WebURL& a, const WebURL& b) |
| { |
| - return a.spec() < b.spec(); |
| + return a.string() < b.string(); |
| } |
| inline bool operator==(const WebURL& a, const WebURL& b) |
| { |
| - return !a.spec().compare(b.spec()); |
| + return !a.string().equals(b.string()); |
|
Jeffrey Yasskin
2013/07/24 21:23:51
s/!//, right?
abarth-chromium
2013/07/24 21:57:34
Yes! :)
|
| } |
| inline bool operator!=(const WebURL& a, const WebURL& b) |