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

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: Add a typemap for Chromium to use 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 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
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