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

Side by Side Diff: content/child/mojo/type_converters.h

Issue 1775953004: bluetooth: Move writeValue to mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Address scheib's comments Created 4 years, 8 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "mojo/public/cpp/bindings/array.h" 8 #include "mojo/public/cpp/bindings/array.h"
9 #include "third_party/WebKit/public/platform/WebString.h"
9 #include "third_party/WebKit/public/platform/WebVector.h" 10 #include "third_party/WebKit/public/platform/WebVector.h"
10 11
11 namespace mojo { 12 namespace mojo {
12 13
13 template <typename T, typename U> 14 template <typename T, typename U>
14 struct TypeConverter<Array<T>, blink::WebVector<U>> { 15 struct TypeConverter<Array<T>, blink::WebVector<U>> {
15 static Array<T> Convert(const blink::WebVector<U>& vector) { 16 static Array<T> Convert(const blink::WebVector<U>& vector) {
16 Array<T> array(vector.size()); 17 Array<T> array(vector.size());
17 for (size_t i = 0; i < vector.size(); ++i) 18 for (size_t i = 0; i < vector.size(); ++i)
18 array[i] = TypeConverter<T, U>::Convert(vector[i]); 19 array[i] = TypeConverter<T, U>::Convert(vector[i]);
19 return std::move(array); 20 return std::move(array);
20 } 21 }
21 }; 22 };
22 23
24 template <>
25 struct TypeConverter<String, blink::WebString> {
26 static String Convert(const blink::WebString& web_string) {
27 return String(web_string.utf8());
28 }
29 };
30
23 } // namespace mojo 31 } // namespace mojo
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.cc ('k') | content/common/bluetooth/bluetooth_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698