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

Side by Side Diff: chrome/browser/ui/app_list/search/playstore/playstore_search_result.h

Issue 2929273002: Add the Play Store app search to the launcher. (Closed)
Patch Set: Resolve Luis comments. Created 3 years, 5 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 unified diff | Download patch
OLDNEW
(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_PLAYSTORE_SEARCH_RESULT_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_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 "ui/app_list/search_result.h"
15
16 class AppListControllerDelegate;
17 class PlayStoreAppContextMenu;
18 class Profile;
19
20 namespace app_list {
21
22 class PlayStoreSearchResult : public SearchResult,
23 public AppContextMenuDelegate {
24 public:
25 PlayStoreSearchResult(const base::Optional<std::string>& launch_intent_uri,
26 const base::Optional<std::string>& install_intent_uri,
27 const base::Optional<std::string>& label,
28 bool is_instant_app,
29 bool is_recent,
30 const base::Optional<std::string>& publisher_name,
31 const base::Optional<std::string>& formatted_price,
32 float review_score,
33 const std::vector<uint8_t>& icon_png_data);
34 ~PlayStoreSearchResult() override;
35 // app_list::SearchResult overrides:
Luis Héctor Chávez 2017/06/22 19:49:17 nit: add newlines around override blocks. So one b
Jiaquan He 2017/06/22 19:59:36 Done.
36 std::unique_ptr<SearchResult> Duplicate() const override;
37 // app_list::AppContextMenuDelegate overrides:
38 ui::MenuModel* GetContextMenuModel() override;
39 void Open(int event_flags) override;
40 void ExecuteLaunchCommand(int event_flags) override;
41
42 const base::Optional<std::string>& launch_intent_uri() const {
43 return launch_intent_uri_;
44 }
45
46 const base::Optional<std::string>& install_intent_uri() const {
47 return install_intent_uri_;
48 }
49
50 const base::Optional<std::string>& label() const { return label_; }
51
52 bool is_instant_app() const { return is_instant_app_; }
53
54 bool is_recent() const { return is_recent_; }
55
56 const base::Optional<std::string>& publisher_name() const {
57 return publisher_name_;
58 }
59
60 const base::Optional<std::string>& formatted_price() const {
61 return formatted_price_;
62 }
63
64 float review_score() const { return review_score_; }
65
66 const std::vector<uint8_t>& icon_png_data() const { return icon_png_data_; }
67
68 void set_profile(Profile* profile) { profile_ = profile; }
69 Profile* profile() const { return profile_; }
70
71 void set_list_controller(AppListControllerDelegate* list_controller) {
72 list_controller_ = list_controller;
73 }
74 AppListControllerDelegate* list_controller() const {
75 return list_controller_;
76 }
77
78 private:
79 class IconDecodeRequest;
80
81 const base::Optional<std::string> launch_intent_uri_;
82 const base::Optional<std::string> install_intent_uri_;
83 const base::Optional<std::string> label_;
84 const bool is_instant_app_;
85 const bool is_recent_;
86 const base::Optional<std::string> publisher_name_;
87 const base::Optional<std::string> formatted_price_;
88 const float review_score_;
89 const std::vector<uint8_t> icon_png_data_;
90
91 std::unique_ptr<IconDecodeRequest> icon_decode_request_;
92
93 // |profile_| is owned by ProfileInfo.
94 Profile* profile_;
95 // |list_controller_| is owned by AppListServiceAsh and lives
96 // until the service finishes.
97 AppListControllerDelegate* list_controller_;
98 std::unique_ptr<PlayStoreAppContextMenu> context_menu_;
99
100 base::WeakPtrFactory<PlayStoreSearchResult> weak_ptr_factory_;
101
102 DISALLOW_COPY_AND_ASSIGN(PlayStoreSearchResult);
103 };
104
105 } // namespace app_list
106
107 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_PLAYSTORE_SEARCH_RESULT_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698