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

Side by Side Diff: components/chrome_cleaner/public/typemaps/chrome_prompt_struct_traits.cc

Issue 2932703006: Chrome Cleaner: Remove indirect base::FilePath mojo dependency. (Closed)
Patch Set: Address review comments on #5 Created 3 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 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
OLDNEW
« no previous file with comments | « components/chrome_cleaner/public/typemaps/chrome_prompt_struct_traits.h ('k') | components/typemaps.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698