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

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

Issue 2684723003: Remove LauncherItemController::Launch, cleanup. (Closed)
Patch Set: Use AppLauncherId 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/app_shortcut_launcher_item_controller.cc
diff --git a/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc
index b42c02a24c6378aa2c6c0171c03660c300725ba7..872431e887a3eb67c9640a09de4965e9a7f8b73c 100644
--- a/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc
+++ b/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc
@@ -92,33 +92,25 @@ AppShortcutLauncherItemController::AppShortcutLauncherItemController(
}
}
-AppShortcutLauncherItemController::~AppShortcutLauncherItemController() {
-}
-
-void AppShortcutLauncherItemController::Launch(ash::LaunchSource source,
- int event_flags) {
- // Launching an app replaces shortcut item controller to app controller. As
- // result app_id_, launch_id_ are deleted during this call. Use local copies
- // to prevent crash condition.
- launcher_controller()->LaunchAppWithLaunchId(
- std::string(app_id()), std::string(launch_id()), source, event_flags);
-}
+AppShortcutLauncherItemController::~AppShortcutLauncherItemController() {}
ash::ShelfItemDelegate::PerformedAction
AppShortcutLauncherItemController::Activate(ash::LaunchSource source) {
content::WebContents* content = GetLRUApplication();
if (!content) {
- if (IsV2App()) {
- // Ideally we come here only once. After that ShellLauncherItemController
- // will take over when the shell window gets opened. However there are
- // apps which take a lot of time for pre-processing (like the files app)
- // before they open a window. Since there is currently no other way to
- // detect if an app was started we suppress any further clicks within a
- // special time out.
- if (!AllowNextLaunchAttempt())
- return kNoAction;
- }
- Launch(source, ui::EF_NONE);
+ // Ideally we come here only once. After that ShellLauncherItemController
+ // will take over when the shell window gets opened. However there are apps
+ // which take a lot of time for pre-processing (like the files app) before
+ // they open a window. Since there is currently no other way to detect if an
+ // app was started we suppress any further clicks within a special time out.
+ if (IsV2App() && !AllowNextLaunchAttempt())
+ return kNoAction;
+
+ // Launching some items replaces this item controller instance, which
+ // destroys the app and launch id strings; making copies avoid crashes.
+ launcher_controller()->LaunchApp(
+ ash::launcher::AppLauncherId(app_id(), launch_id()), source,
+ ui::EF_NONE);
return kNewWindowCreated;
}
return ActivateContent(content);

Powered by Google App Engine
This is Rietveld 408576698