Index: chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc |
diff --git a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc |
index 51c637f55b6d11bfc7898216483aa935d27ad08d..40efb4fa47272dbf6f7a169e4c3e15acaf25ab88 100644 |
--- a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc |
+++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc |
@@ -144,18 +144,18 @@ void ShellWindowLauncherItemController::Clicked(const ui::Event& event) { |
// activate it. |
if (ash::wm::MoveWindowToEventRoot(panel->GetNativeWindow(), event)) { |
if (!panel->GetBaseWindow()->IsActive()) |
- ShowAndActivate(panel); |
+ ShowAndActivateOrMinimize(panel); |
} else { |
if (panel->GetBaseWindow()->IsActive()) |
panel->GetBaseWindow()->Minimize(); |
else |
- ShowAndActivate(panel); |
+ ShowAndActivateOrMinimize(panel); |
} |
} else if (launcher_controller()->GetPerAppInterface() || |
shell_windows_.size() == 1) { |
ShellWindow* window_to_show = last_active_shell_window_ ? |
last_active_shell_window_ : shell_windows_.front(); |
- ShowAndActivate(window_to_show); |
+ ShowAndActivateOrMinimize(window_to_show); |
} else { |
// TODO(stevenjb): Deprecate |
if (!last_active_shell_window_ || |
@@ -169,7 +169,7 @@ void ShellWindowLauncherItemController::Clicked(const ui::Event& event) { |
} |
} |
if (last_active_shell_window_) |
- ShowAndActivate(last_active_shell_window_); |
+ ShowAndActivateOrMinimize(last_active_shell_window_); |
} |
} |
@@ -178,7 +178,7 @@ void ShellWindowLauncherItemController::ActivateIndexedApp(size_t index) { |
return; |
ShellWindowList::iterator it = shell_windows_.begin(); |
std::advance(it, index); |
- ShowAndActivate(*it); |
+ ShowAndActivateOrMinimize(*it); |
} |
ChromeLauncherAppMenuItems |
@@ -219,9 +219,10 @@ void ShellWindowLauncherItemController::OnWindowPropertyChanged( |
} |
} |
-void ShellWindowLauncherItemController::ShowAndActivate( |
+void ShellWindowLauncherItemController::ShowAndActivateOrMinimize( |
ShellWindow* shell_window) { |
- // Always activate windows when shown from the launcher. |
- shell_window->GetBaseWindow()->Show(); |
- shell_window->GetBaseWindow()->Activate(); |
+ // Either show or minimize windows when shown from the launcher. |
+ launcher_controller()->ActivateWindowOrMinimizeIfActive( |
+ shell_window->GetBaseWindow(), |
+ GetApplicationList().size() == 2); |
} |