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

Unified Diff: chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.cc

Issue 2929273002: Add the Play Store app search to the launcher. (Closed)
Patch Set: Resolve Luis comments. 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 side-by-side diff with in-line comments
Download patch
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..cf53376a61cf69a2dac171357de34995c82a20ec
--- /dev/null
+++ b/chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.cc
@@ -0,0 +1,50 @@
+// 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"
+
+#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.
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace mojo {
+
+bool StructTraits<arc::mojom::AppDiscoveryResultDataView,
+ std::unique_ptr<app_list::PlayStoreSearchResult>>::
+ Read(arc::mojom::AppDiscoveryResultDataView data,
+ std::unique_ptr<app_list::PlayStoreSearchResult>* 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

Powered by Google App Engine
This is Rietveld 408576698