| 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_ARC_ARC_PLAYSTORE_SEARCH_RESULT_H_ | |
| 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_ARC_ARC_PLAYSTORE_SEARCH_RESULT_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 #include <string> | |
| 10 #include <vector> | |
| 11 | |
| 12 #include "base/optional.h" | |
| 13 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" | |
| 14 #include "components/arc/common/app.mojom.h" | |
| 15 #include "ui/app_list/search_result.h" | |
| 16 | |
| 17 class AppListControllerDelegate; | |
| 18 class ArcPlayStoreAppContextMenu; | |
| 19 class Profile; | |
| 20 | |
| 21 namespace app_list { | |
| 22 | |
| 23 class ArcPlayStoreSearchResult : public SearchResult, | |
| 24 public AppContextMenuDelegate { | |
| 25 public: | |
| 26 ArcPlayStoreSearchResult(arc::mojom::AppDiscoveryResultPtr data, | |
| 27 Profile* profile, | |
| 28 AppListControllerDelegate* list_controller_); | |
| 29 ~ArcPlayStoreSearchResult() override; | |
| 30 | |
| 31 // app_list::SearchResult overrides: | |
| 32 std::unique_ptr<SearchResult> Duplicate() const override; | |
| 33 | |
| 34 // app_list::AppContextMenuDelegate overrides: | |
| 35 ui::MenuModel* GetContextMenuModel() override; | |
| 36 void Open(int event_flags) override; | |
| 37 void ExecuteLaunchCommand(int event_flags) override; | |
| 38 | |
| 39 private: | |
| 40 class IconDecodeRequest; | |
| 41 | |
| 42 const base::Optional<std::string>& install_intent_uri() const { | |
| 43 return data_->install_intent_uri; | |
| 44 } | |
| 45 const base::Optional<std::string>& label() const { return data_->label; } | |
| 46 bool is_instant_app() const { return data_->is_instant_app; } | |
| 47 const base::Optional<std::string>& formatted_price() const { | |
| 48 return data_->formatted_price; | |
| 49 } | |
| 50 float review_score() const { return data_->review_score; } | |
| 51 const std::vector<uint8_t>& icon_png_data() const { | |
| 52 return data_->icon_png_data; | |
| 53 } | |
| 54 | |
| 55 arc::mojom::AppDiscoveryResultPtr data_; | |
| 56 std::unique_ptr<IconDecodeRequest> icon_decode_request_; | |
| 57 | |
| 58 // |profile_| is owned by ProfileInfo. | |
| 59 Profile* const profile_; | |
| 60 // |list_controller_| is owned by AppListServiceAsh and lives | |
| 61 // until the service finishes. | |
| 62 AppListControllerDelegate* const list_controller_; | |
| 63 std::unique_ptr<ArcPlayStoreAppContextMenu> context_menu_; | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(ArcPlayStoreSearchResult); | |
| 66 }; | |
| 67 | |
| 68 } // namespace app_list | |
| 69 | |
| 70 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_ARC_ARC_PLAYSTORE_SEARCH_RESULT_H_ | |
| OLD | NEW |