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

Unified Diff: chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc

Issue 2793223002: arc: Fix crash activating Play Store in deferred mode. (Closed)
Patch Set: check if request was already scheduled Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc
index da6cfe61c47154852cfcc458e0652d8a617e7b53..bd631c174181590013089b867e015ff9ab95949a 100644
--- a/chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/arc_playstore_shortcut_launcher_item_controller.cc
@@ -27,8 +27,18 @@ void ArcPlaystoreShortcutLauncherItemController::ItemSelected(
int64_t display_id,
ash::ShelfLaunchSource source,
const ItemSelectedCallback& callback) {
- playstore_launcher_ = base::MakeUnique<ArcAppLauncher>(
- controller()->profile(), arc::kPlayStoreAppId, true, true);
- callback.Run(ash::SHELF_ACTION_NONE,
- GetAppMenuItems(event ? event->flags() : ui::EF_NONE));
+ if (!playstore_launcher_) {
+ // Play Store launch request has never been scheduled.
+ std::unique_ptr<ArcAppLauncher> playstore_launcher =
+ base::MakeUnique<ArcAppLauncher>(
+ controller()->profile(), arc::kPlayStoreAppId,
+ true /* landscape_layout */, true /* deferred_launch_allowed */);
+ // ArcAppLauncher may launch Play Store in case it exists already. In this
+ // case this instance of ArcPlaystoreShortcutLauncherItemController may be
+ // deleted. If Play Store does not exist at this moment, then let
+ // |playstore_launcher_| wait until it appears.
+ if (!playstore_launcher->app_launched())
+ playstore_launcher_ = std::move(playstore_launcher);
+ }
+ callback.Run(ash::SHELF_ACTION_NONE, base::nullopt);
}
« no previous file with comments | « no previous file | chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698