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

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

Issue 2684723003: Remove LauncherItemController::Launch, cleanup. (Closed)
Patch Set: Cleanup Created 3 years, 10 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/ash/launcher/chrome_launcher_controller_impl.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
index 6d6f16d690c98eaa9a4fea47d0744fd589e6c052..972eb77b342af80af82b3f8afb63f5f204b6281d 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
@@ -414,7 +414,12 @@ void ChromeLauncherControllerImpl::Launch(ash::ShelfID id, int event_flags) {
LauncherItemController* controller = GetLauncherItemController(id);
if (!controller)
return; // In case invoked from menu and item closed while menu up.
- controller->Launch(ash::LAUNCH_FROM_UNKNOWN, event_flags);
+
+ // Launching some items replaces the associated item controller instance,
+ // which destroys the app and launch id strings; use copies to avoid crashes.
+ std::string app_id = controller->app_id();
+ std::string launch_id = controller->launch_id();
+ LaunchApp(app_id, launch_id, ash::LAUNCH_FROM_UNKNOWN, event_flags);
}
void ChromeLauncherControllerImpl::Close(ash::ShelfID id) {
@@ -454,11 +459,11 @@ void ChromeLauncherControllerImpl::ActivateApp(const std::string& app_id,
// Create a temporary application launcher item and use it to see if there are
// running instances.
std::unique_ptr<AppShortcutLauncherItemController> app_controller(
- AppShortcutLauncherItemController::Create(app_id, "", this));
+ AppShortcutLauncherItemController::Create(app_id, std::string(), this));
if (!app_controller->GetRunningApplications().empty())
app_controller->Activate(source);
else
- LaunchApp(app_id, source, event_flags);
+ LaunchApp(app_id, std::string(), source, event_flags);
}
void ChromeLauncherControllerImpl::SetLauncherItemImage(

Powered by Google App Engine
This is Rietveld 408576698