Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: third_party/WebKit/Source/platform/mojo/KURLStructTraits.h

Issue 2000253006: Implement URL and Origin typemaps/struct traits for blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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> {
16 static WTF::String url(const ::blink::KURL& r)
esprehn 2016/05/25 17:06:27 what calls this? Nothing in this file seems to use
Marijn Kruisselbrink 2016/05/25 17:35:08 This matches the "url" field in the url.mojom.Url
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698