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

Unified Diff: chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h

Issue 2929273002: Add the Play Store app search to the launcher. (Closed)
Patch Set: Fix the badge not showing issue. 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/arc/arc_playstore_search_result.h
diff --git a/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h
new file mode 100644
index 0000000000000000000000000000000000000000..514ebc2502e02d5f0fab4af651ed60073e1eb1a8
--- /dev/null
+++ b/chrome/browser/ui/app_list/search/arc/arc_playstore_search_result.h
@@ -0,0 +1,77 @@
+// 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_ARC_ARC_PLAYSTORE_SEARCH_RESULT_H_
+#define CHROME_BROWSER_UI_APP_LIST_SEARCH_ARC_ARC_PLAYSTORE_SEARCH_RESULT_H_
+
+#include <memory>
+#include <string>
+#include <vector>
+
+#include "base/optional.h"
+#include "chrome/browser/ui/app_list/app_context_menu_delegate.h"
+#include "components/arc/common/app.mojom.h"
+#include "ui/app_list/search_result.h"
+
+class AppListControllerDelegate;
+class ArcPlayStoreAppContextMenu;
+class Profile;
+
+namespace app_list {
+
+class ArcPlayStoreSearchResult : public SearchResult,
+ public AppContextMenuDelegate {
+ public:
+ ArcPlayStoreSearchResult(arc::mojom::AppDiscoveryResultPtr data,
+ Profile* profile,
+ AppListControllerDelegate* list_controller_);
+ ~ArcPlayStoreSearchResult() override;
+
+ // app_list::SearchResult overrides:
+ std::unique_ptr<SearchResult> Duplicate() const override;
+
+ // app_list::AppContextMenuDelegate overrides:
+ ui::MenuModel* GetContextMenuModel() override;
+ void Open(int event_flags) override;
+ void ExecuteLaunchCommand(int event_flags) override;
+
+ private:
+ class IconDecodeRequest;
+
+ 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.
+ 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.
+ return data_->launch_intent_uri;
+ }
+ const base::Optional<std::string> install_intent_uri() {
+ return data_->install_intent_uri;
+ }
+ const base::Optional<std::string> label() { return data_->label; }
+ bool is_instant_app() { return data_->is_instant_app; }
+ bool is_recent() { return data_->is_recent; }
+ const base::Optional<std::string> publisher_name() {
+ return data_->publisher_name;
+ }
+ const base::Optional<std::string> formatted_price() {
+ return data_->formatted_price;
+ }
+ float review_score() { return data_->review_score; }
+ 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.
+
+ std::unique_ptr<IconDecodeRequest> icon_decode_request_;
+
+ // |profile_| is owned by ProfileInfo.
+ Profile* const profile_;
+ // |list_controller_| is owned by AppListServiceAsh and lives
+ // until the service finishes.
+ AppListControllerDelegate* const list_controller_;
+ std::unique_ptr<ArcPlayStoreAppContextMenu> context_menu_;
+
+ base::WeakPtrFactory<ArcPlayStoreSearchResult> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ArcPlayStoreSearchResult);
+};
+
+} // namespace app_list
+
+#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_ARC_ARC_PLAYSTORE_SEARCH_RESULT_H_

Powered by Google App Engine
This is Rietveld 408576698