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 "chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_ traits.h" | |
6 | |
7 #include <memory> | |
Luis Héctor Chávez
2017/06/22 19:49:17
Leave only utility
Jiaquan He
2017/06/22 19:59:36
Done.
| |
8 #include <string> | |
9 #include <utility> | |
10 #include <vector> | |
11 | |
12 namespace mojo { | |
13 | |
14 bool StructTraits<arc::mojom::AppDiscoveryResultDataView, | |
15 std::unique_ptr<app_list::PlayStoreSearchResult>>:: | |
16 Read(arc::mojom::AppDiscoveryResultDataView data, | |
17 std::unique_ptr<app_list::PlayStoreSearchResult>* out) { | |
18 base::Optional<std::string> launch_intent_uri; | |
19 if (!data.ReadLaunchIntentUri(&launch_intent_uri)) | |
20 return false; | |
21 | |
22 base::Optional<std::string> install_intent_uri; | |
23 if (!data.ReadInstallIntentUri(&install_intent_uri)) | |
24 return false; | |
25 | |
26 base::Optional<std::string> label; | |
27 if (!data.ReadLabel(&label)) | |
28 return false; | |
29 | |
30 base::Optional<std::string> publisher_name; | |
31 if (!data.ReadPublisherName(&publisher_name)) | |
32 return false; | |
33 | |
34 base::Optional<std::string> formatted_price; | |
35 if (!data.ReadFormattedPrice(&formatted_price)) | |
36 return false; | |
37 | |
38 std::vector<uint8_t> icon_png_data; | |
39 if (!data.ReadIconPngData(&icon_png_data)) | |
40 return false; | |
41 | |
42 *out = base::MakeUnique<app_list::PlayStoreSearchResult>( | |
43 std::move(launch_intent_uri), std::move(install_intent_uri), | |
44 std::move(label), data.is_instant_app(), data.is_recent(), | |
45 std::move(publisher_name), std::move(formatted_price), | |
46 data.review_score(), std::move(icon_png_data)); | |
47 return true; | |
48 } | |
49 | |
50 } // namespace mojo | |
OLD | NEW |