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 arc::mojom::AppDiscoveryResultPtr data_; | |
xiyuan
2017/06/23 19:57:38
Data member should be declared after all methods
Jiaquan He
2017/06/23 21:10:32
Done.
| |
43 const base::Optional<std::string> launch_intent_uri() { | |
xiyuan
2017/06/23 19:57:38
Make it a const method and return a const &, here
Jiaquan He
2017/06/23 21:10:32
Done.
| |
44 return data_->launch_intent_uri; | |
45 } | |
46 const base::Optional<std::string> install_intent_uri() { | |
47 return data_->install_intent_uri; | |
48 } | |
49 const base::Optional<std::string> label() { return data_->label; } | |
50 bool is_instant_app() { return data_->is_instant_app; } | |
51 bool is_recent() { return data_->is_recent; } | |
52 const base::Optional<std::string> publisher_name() { | |
53 return data_->publisher_name; | |
54 } | |
55 const base::Optional<std::string> formatted_price() { | |
56 return data_->formatted_price; | |
57 } | |
58 float review_score() { return data_->review_score; } | |
59 const std::vector<uint8_t> icon_png_data() { return data_->icon_png_data; } | |
xiyuan
2017/06/23 19:57:38
nit: const std::vector<uint8_t>&, to avoid copy
Jiaquan He
2017/06/23 21:10:32
Done.
| |
60 | |
61 std::unique_ptr<IconDecodeRequest> icon_decode_request_; | |
62 | |
63 // |profile_| is owned by ProfileInfo. | |
64 Profile* const profile_; | |
65 // |list_controller_| is owned by AppListServiceAsh and lives | |
66 // until the service finishes. | |
67 AppListControllerDelegate* const list_controller_; | |
68 std::unique_ptr<ArcPlayStoreAppContextMenu> context_menu_; | |
69 | |
70 base::WeakPtrFactory<ArcPlayStoreSearchResult> weak_ptr_factory_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(ArcPlayStoreSearchResult); | |
73 }; | |
74 | |
75 } // namespace app_list | |
76 | |
77 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_ARC_ARC_PLAYSTORE_SEARCH_RESULT_H_ | |
OLD | NEW |