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

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

Issue 2696073002: Merge ShelfItemDelegate::ItemSelected & LauncherItemDelegate::Activate. (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 1a50f01857ea8adb4bb61f654fb965711d222dde..f336ea99fbb2a9d3fb6bcda44615516fde193cca 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.cc
@@ -51,7 +51,6 @@
#include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_browser.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_tab.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h"
-#include "chrome/browser/ui/ash/launcher/chrome_launcher_types.h"
#include "chrome/browser/ui/ash/launcher/launcher_arc_app_updater.h"
#include "chrome/browser/ui/ash/launcher/launcher_controller_helper.h"
#include "chrome/browser/ui/ash/launcher/launcher_extension_app_updater.h"
@@ -446,22 +445,23 @@ bool ChromeLauncherControllerImpl::IsPlatformApp(ash::ShelfID id) {
}
void ChromeLauncherControllerImpl::ActivateApp(const std::string& app_id,
- ash::LaunchSource source,
+ ash::ShelfLaunchSource source,
int event_flags) {
+ int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
James Cook 2017/02/15 00:44:40 Is it correct to assume the primary display here?
msw 2017/02/15 19:59:18 Good idea, I've replaced assumptions of primary wi
// If there is an existing non-shortcut controller for this app, open it.
ash::ShelfID id = GetShelfIDForAppID(app_id);
if (id) {
- LauncherItemController* controller = GetLauncherItemController(id);
- controller->Activate(source);
+ ash::ShelfItemDelegate* delegate = model_->GetShelfItemDelegate(id);
+ delegate->ItemSelected(ui::ET_UNKNOWN, event_flags, display_id, source);
return;
}
// Create a temporary application launcher item and use it to see if there are
// running instances.
- std::unique_ptr<AppShortcutLauncherItemController> app_controller(
+ std::unique_ptr<AppShortcutLauncherItemController> controller(
AppShortcutLauncherItemController::Create(app_id, std::string(), this));
- if (!app_controller->GetRunningApplications().empty())
- app_controller->Activate(source);
+ if (!controller->GetRunningApplications().empty())
+ controller->ItemSelected(ui::ET_UNKNOWN, event_flags, display_id, source);
else
LaunchApp(ash::AppLauncherId(app_id), source, event_flags);
}
@@ -551,8 +551,7 @@ void ChromeLauncherControllerImpl::SetRefocusURLPatternForTest(
}
}
-ash::ShelfItemDelegate::PerformedAction
-ChromeLauncherControllerImpl::ActivateWindowOrMinimizeIfActive(
+ash::ShelfAction ChromeLauncherControllerImpl::ActivateWindowOrMinimizeIfActive(
ui::BaseWindow* window,
bool allow_minimize) {
// In separated desktop mode we might have to teleport a window back to the
@@ -569,18 +568,18 @@ ChromeLauncherControllerImpl::ActivateWindowOrMinimizeIfActive(
ash::MultiProfileUMA::TELEPORT_WINDOW_RETURN_BY_LAUNCHER);
manager->ShowWindowForUser(native_window, current_account_id);
window->Activate();
- return ash::ShelfItemDelegate::kExistingWindowActivated;
+ return ash::kExistingWindowActivated;
}
}
if (window->IsActive() && allow_minimize) {
window->Minimize();
- return ash::ShelfItemDelegate::kNoAction;
+ return ash::kNoAction;
}
window->Show();
window->Activate();
- return ash::ShelfItemDelegate::kExistingWindowActivated;
+ return ash::kExistingWindowActivated;
}
void ChromeLauncherControllerImpl::ActiveUserChanged(

Powered by Google App Engine
This is Rietveld 408576698