| Index: chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.cc
|
| diff --git a/chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.cc b/chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4f0363f0753881abf770b5f2d707c29ec6fa56a1
|
| --- /dev/null
|
| +++ b/chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.cc
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.h"
|
| +
|
| +namespace mojo {
|
| +
|
| +bool StructTraits<arc::mojom::AppDiscoveryResultDataView,
|
| + app_list::PlayStoreSearchResultUniquePtr>::
|
| + Read(arc::mojom::AppDiscoveryResultDataView data,
|
| + app_list::PlayStoreSearchResultUniquePtr* out) {
|
| + base::Optional<std::string> launch_intent_uri;
|
| + if (!data.ReadLaunchIntentUri(&launch_intent_uri))
|
| + return false;
|
| +
|
| + base::Optional<std::string> install_intent_uri;
|
| + if (!data.ReadInstallIntentUri(&install_intent_uri))
|
| + return false;
|
| +
|
| + base::Optional<std::string> label;
|
| + if (!data.ReadLabel(&label))
|
| + return false;
|
| +
|
| + base::Optional<std::string> publisher_name;
|
| + if (!data.ReadPublisherName(&publisher_name))
|
| + return false;
|
| +
|
| + base::Optional<std::string> formatted_price;
|
| + if (!data.ReadFormattedPrice(&formatted_price))
|
| + return false;
|
| +
|
| + std::vector<uint8_t> icon_png_data;
|
| + if (!data.ReadIconPngData(&icon_png_data))
|
| + return false;
|
| +
|
| + *out = base::MakeUnique<app_list::PlayStoreSearchResult>(
|
| + std::move(launch_intent_uri), std::move(install_intent_uri),
|
| + std::move(label), data.is_instant_app(), data.is_recent(),
|
| + std::move(publisher_name), std::move(formatted_price),
|
| + data.review_score(), std::move(icon_png_data));
|
| + return true;
|
| +}
|
| +
|
| +} // namespace mojo
|
|
|