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 ConstCArray<uint16_t> |
| 11 StructTraits<chrome_cleaner::mojom::FilePathDataView, base::FilePath>::value( |
| 12 const base::FilePath& file_path) { |
| 13 #if defined(OS_WIN) |
| 14 return ConstCArray<uint16_t>( |
| 15 file_path.value().size(), |
| 16 reinterpret_cast<const uint16_t*>(file_path.value().data())); |
| 17 #else |
| 18 NOTREACHED(); |
| 19 return ConstCArray<uint16_t>(); |
| 20 #endif |
| 21 } |
| 22 |
| 23 // static |
| 24 bool StructTraits<chrome_cleaner::mojom::FilePathDataView, |
| 25 base::FilePath>::Read(chrome_cleaner::mojom::FilePathDataView |
| 26 path_view, |
| 27 base::FilePath* out) { |
| 28 #if defined(OS_WIN) |
| 29 ArrayDataView<uint16_t> view; |
| 30 path_view.GetValueDataView(&view); |
| 31 base::FilePath path = base::FilePath(base::string16( |
| 32 reinterpret_cast<const base::char16*>(view.data()), view.size())); |
| 33 *out = std::move(path); |
| 34 return true; |
| 35 #else |
| 36 NOTREACHED(); |
| 37 return false; |
| 38 #endif |
| 39 } |
| 40 |
| 41 } // namespace mojo |
OLD | NEW |