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

Unified 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: Finished comments and merged with the context menu CL. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/search/playstore/playstore_search_result.h
diff --git a/chrome/browser/ui/app_list/search/playstore/playstore_search_result.h b/chrome/browser/ui/app_list/search/playstore/playstore_search_result.h
new file mode 100644
index 0000000000000000000000000000000000000000..46c9c366b98625689b11edfc463c2645015f9783
--- /dev/null
+++ b/chrome/browser/ui/app_list/search/playstore/playstore_search_result.h
@@ -0,0 +1,110 @@
+// 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_PLAYSTORE_SEARCH_RESULT_H_
+#define CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_PLAYSTORE_SEARCH_RESULT_H_
+
+#include "base/optional.h"
+#include "chrome/browser/ui/app_list/app_context_menu_delegate.h"
+#include "ui/app_list/search_result.h"
+
+#if defined(OS_CHROMEOS)
Luis Héctor Chávez 2017/06/22 15:42:10 Remove. Move this #if to where you are including i
Jiaquan He 2017/06/22 19:12:41 Done.
+
+class AppListControllerDelegate;
+class PlayStoreAppContextMenu;
+class Profile;
+
+namespace app_list {
+
+class PlayStoreSearchResult : public SearchResult,
+ public AppContextMenuDelegate {
+ public:
+ // app_list::SearchResult overrides:
Luis Héctor Chávez 2017/06/22 15:42:10 Move this to after L34. The ctors/dtor are typical
Jiaquan He 2017/06/22 19:12:41 Done.
+ PlayStoreSearchResult();
Luis Héctor Chávez 2017/06/22 15:42:10 Why do you need this constructor?
Jiaquan He 2017/06/22 19:12:41 Done.
+ PlayStoreSearchResult(const base::Optional<std::string>& launch_intent_uri,
+ const base::Optional<std::string>& install_intent_uri,
+ const base::Optional<std::string>& label,
+ bool is_instant_app,
+ bool is_recent,
+ const base::Optional<std::string>& publisher_name,
+ const base::Optional<std::string>& formatted_price,
+ float review_score,
+ const std::vector<uint8_t>& icon_png_data);
+ ~PlayStoreSearchResult() override;
+ std::unique_ptr<SearchResult> Duplicate() const override;
+ ui::MenuModel* GetContextMenuModel() override;
+ void ExecuteLaunchCommand(int event_flags) override;
Luis Héctor Chávez 2017/06/22 15:42:10 Move this to after L39 and add an overrides: comme
Jiaquan He 2017/06/22 19:12:42 Done.
+ void Open(int event_flags) override;
+
+ const base::Optional<std::string>& launch_intent_uri() const {
+ return launch_intent_uri_;
+ }
+
+ const base::Optional<std::string>& install_intent_uri() const {
+ return install_intent_uri_;
+ }
+
+ const base::Optional<std::string>& label() const { return label_; }
+
+ bool is_instant_app() const { return is_instant_app_; }
+
+ bool is_recent() const { return is_recent_; }
+
+ const base::Optional<std::string>& publisher_name() const {
+ return publisher_name_;
+ }
+
+ const base::Optional<std::string>& formatted_price() const {
+ return formatted_price_;
+ }
+
+ float review_score() const { return review_score_; }
+
+ const std::vector<uint8_t>& icon_png_data() const { return icon_png_data_; }
+
+ void set_profile(Profile* profile) { profile_ = profile; }
+ Profile* profile() const { return profile_; }
+
+ void set_list_controller(AppListControllerDelegate* list_controller) {
+ list_controller_ = list_controller;
+ }
+ AppListControllerDelegate* list_controller() const {
+ return list_controller_;
+ }
+
+ private:
+ class IconSource;
Luis Héctor Chávez 2017/06/22 15:42:10 You are not referring to IconSource anywhere in th
Jiaquan He 2017/06/22 19:12:41 Done.
+ class IconDecodeRequest;
+
+ const base::Optional<std::string> launch_intent_uri_;
+ const base::Optional<std::string> install_intent_uri_;
+ const base::Optional<std::string> label_;
+ const bool is_instant_app_;
+ const bool is_recent_;
+ const base::Optional<std::string> publisher_name_;
+ const base::Optional<std::string> formatted_price_;
+ const float review_score_;
+ const std::vector<uint8_t> icon_png_data_;
+
+ std::unique_ptr<IconDecodeRequest> icon_decode_request_;
+
+ // profile_ is ownd by ProfileInfo.
Luis Héctor Chávez 2017/06/22 15:42:10 nit: |profile_| is owned
Jiaquan He 2017/06/22 19:12:42 Done.
+ Profile* profile_;
+ // list_controller_ is owned by AppListServiceAsh and lives
Luis Héctor Chávez 2017/06/22 15:42:10 nit: |list_controller_|
Jiaquan He 2017/06/22 19:12:41 Done.
+ // until the service finishes.
+ AppListControllerDelegate* list_controller_;
+ std::unique_ptr<PlayStoreAppContextMenu> context_menu_;
+
+ base::WeakPtrFactory<PlayStoreSearchResult> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(PlayStoreSearchResult);
+};
+
+using PlayStoreSearchResultUniquePtr = std::unique_ptr<PlayStoreSearchResult>;
Luis Héctor Chávez 2017/06/22 15:42:10 remove
Jiaquan He 2017/06/22 19:12:41 Done.
+
+} // namespace app_list
+
+#endif
+
+#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_PLAYSTORE_PLAYSTORE_SEARCH_RESULT_H_

Powered by Google App Engine
This is Rietveld 408576698