OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 #include "components/chrome_cleaner/public/typemaps/chrome_prompt_struct_traits. h" | |
6 | |
7 namespace mojo { | |
8 | |
9 // static | |
10 std::vector<uint16_t> | |
11 StructTraits<chrome_cleaner::mojom::FilePathDataView, base::FilePath>::value( | |
12 const base::FilePath& file_path) { | |
13 #if defined(OS_WIN) | |
14 return std::vector<uint16_t>(file_path.value().begin(), | |
dcheng
2017/06/13 23:45:35
I have bad news... this gets called twice on seria
proberge
2017/06/14 14:13:58
Done.
| |
15 file_path.value().end()); | |
16 #else | |
17 NOTREACHED(); | |
18 return std::vector<uint16_t>(); | |
19 #endif | |
20 } | |
21 | |
22 // static | |
23 bool StructTraits<chrome_cleaner::mojom::FilePathDataView, | |
24 base::FilePath>::Read(chrome_cleaner::mojom::FilePathDataView | |
25 path_view, | |
26 base::FilePath* out) { | |
27 #if defined(OS_WIN) | |
28 ArrayDataView<uint16_t> view; | |
29 path_view.GetValueDataView(&view); | |
30 base::FilePath path = base::FilePath(base::string16( | |
31 reinterpret_cast<const base::char16*>(view.data()), view.size())); | |
ftirelo
2017/06/13 23:29:29
Nit: could we use base::FilePath::StringType::valu
proberge
2017/06/14 14:13:58
Maybe. Is this so we can remove the defined(OS_WIN
| |
32 *out = std::move(path); | |
33 return true; | |
34 #else | |
35 NOTREACHED(); | |
36 return false; | |
37 #endif | |
38 } | |
39 | |
40 } // namespace mojo | |
OLD | NEW |