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

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: Created 4 years, 7 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> {
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/mojo/KURLSecurityOriginTest.cpp ('k') | third_party/WebKit/Source/platform/mojo/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698