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 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_MOJO_APP_DISCOVERY_RESULT_TR
AITS_H_ |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_MOJO_APP_DISCOVERY_RESULT_TR
AITS_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <string> |
| 10 #include <vector> |
| 11 |
| 12 #include "chrome/browser/ui/app_list/search/playstore/playstore_search_result.h" |
| 13 #include "components/arc/common/app.mojom.h" |
| 14 #include "mojo/public/cpp/bindings/struct_traits.h" |
| 15 |
| 16 namespace mojo { |
| 17 |
| 18 template <> |
| 19 struct StructTraits<arc::mojom::AppDiscoveryResultDataView, |
| 20 std::unique_ptr<app_list::PlayStoreSearchResult>> { |
| 21 public: |
| 22 static const base::Optional<std::string>& launch_intent_uri( |
| 23 const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
| 24 return r->launch_intent_uri(); |
| 25 } |
| 26 static const base::Optional<std::string>& install_intent_uri( |
| 27 const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
| 28 return r->install_intent_uri(); |
| 29 } |
| 30 static const base::Optional<std::string>& label( |
| 31 const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
| 32 return r->label(); |
| 33 } |
| 34 static bool is_instant_app( |
| 35 const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
| 36 return r->is_instant_app(); |
| 37 } |
| 38 static bool is_recent( |
| 39 const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
| 40 return r->is_recent(); |
| 41 } |
| 42 static const base::Optional<std::string>& publisher_name( |
| 43 const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
| 44 return r->publisher_name(); |
| 45 } |
| 46 static const base::Optional<std::string>& formatted_price( |
| 47 const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
| 48 return r->formatted_price(); |
| 49 } |
| 50 static float review_score( |
| 51 const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
| 52 return r->review_score(); |
| 53 } |
| 54 static const std::vector<uint8_t>& icon_png_data( |
| 55 const std::unique_ptr<app_list::PlayStoreSearchResult>& r) { |
| 56 return r->icon_png_data(); |
| 57 } |
| 58 |
| 59 static bool Read(arc::mojom::AppDiscoveryResultDataView data, |
| 60 std::unique_ptr<app_list::PlayStoreSearchResult>* out); |
| 61 }; |
| 62 |
| 63 } // namespace mojo |
| 64 |
| 65 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_MOJO_APP_DISCOVERY_RESULT
_TRAITS_H_ |
OLD | NEW |