OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef KURLStructTraits_h | |
6 #define KURLStructTraits_h | |
7 | |
8 #include "platform/weborigin/KURL.h" | |
9 #include "url/mojo/url.mojom-blink.h" | |
10 #include "url/url_constants.h" | |
11 | |
12 namespace mojo { | |
13 | |
14 template <> | |
15 struct StructTraits<url::mojom::blink::Url, blink::KURL> { | |
Ken Rockot(use gerrit already)
2016/05/25 15:09:20
You will need to qualify blink::KURL here for now.
yzshen1
2016/05/25 16:43:14
Ah, that seems unfortunate. Moving those things in
| |
16 static WTF::String url(const blink::KURL& r) | |
17 { | |
18 if (!r.isValid() || r.getString().length() > url::kMaxURLChars) { | |
19 return emptyString(); | |
20 } | |
21 | |
22 return r.getString(); | |
23 } | |
24 static bool Read(url::mojom::blink::UrlDataView data, blink::KURL* out) | |
25 { | |
26 WTF::String urlString; | |
27 if (!data.ReadUrl(&urlString)) | |
28 return false; | |
29 | |
30 if (urlString.length() > url::kMaxURLChars) | |
31 return false; | |
32 | |
33 *out = blink::KURL(blink::KURL(), urlString); | |
34 if (!urlString.isEmpty() && !out->isValid()) | |
35 return false; | |
36 | |
37 return true; | |
38 } | |
39 }; | |
40 } | |
41 | |
42 #endif // KURLStructTraits_h | |
OLD | NEW |