Index: chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.h |
diff --git a/chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.h b/chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3ea1db849e89e30f6e8f47ee7035f5519a840148 |
--- /dev/null |
+++ b/chrome/browser/ui/app_list/search/playstore/mojo/app_discovery_result_traits.h |
@@ -0,0 +1,65 @@ |
+// 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. |
+ |
+#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_MOJO_APP_DISCOVERY_RESULT_TRAITS_H_ |
+#define CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_MOJO_APP_DISCOVERY_RESULT_TRAITS_H_ |
+ |
+#include <memory> |
+#include <string> |
+#include <vector> |
+ |
+#include "chrome/browser/ui/app_list/search/playstore/playstore_search_result.h" |
+#include "components/arc/common/app.mojom.h" |
+#include "mojo/public/cpp/bindings/struct_traits.h" |
+ |
+namespace mojo { |
+ |
+template <> |
+struct StructTraits<arc::mojom::AppDiscoveryResultDataView, |
+ std::unique_ptr<app_list::PlayStoreSearchResult>> { |
+ public: |
+ static const base::Optional<std::string>& launch_intent_uri( |
+ const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
+ return r->launch_intent_uri(); |
+ } |
+ static const base::Optional<std::string>& install_intent_uri( |
+ const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
+ return r->install_intent_uri(); |
+ } |
+ static const base::Optional<std::string>& label( |
+ const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
+ return r->label(); |
+ } |
+ static bool is_instant_app( |
+ const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
+ return r->is_instant_app(); |
+ } |
+ static bool is_recent( |
+ const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
+ return r->is_recent(); |
+ } |
+ static const base::Optional<std::string>& publisher_name( |
+ const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
+ return r->publisher_name(); |
+ } |
+ static const base::Optional<std::string>& formatted_price( |
+ const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
+ return r->formatted_price(); |
+ } |
+ static float review_score( |
+ const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
+ return r->review_score(); |
+ } |
+ static const std::vector<uint8_t>& icon_png_data( |
+ const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
+ return r->icon_png_data(); |
+ } |
+ |
+ static bool Read(arc::mojom::AppDiscoveryResultDataView data, |
+ std::unique_ptr<app_list::PlayStoreSearchResult>* out); |
+}; |
+ |
+} // namespace mojo |
+ |
+#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_MOJO_APP_DISCOVERY_RESULT_TRAITS_H_ |