| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" | 5 #include "chrome/browser/ui/ash/launcher/app_window_launcher_item_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 10 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 return *iter; | 65 return *iter; |
| 66 return nullptr; | 66 return nullptr; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void AppWindowLauncherItemController::SetActiveWindow(aura::Window* window) { | 69 void AppWindowLauncherItemController::SetActiveWindow(aura::Window* window) { |
| 70 ui::BaseWindow* app_window = GetAppWindow(window); | 70 ui::BaseWindow* app_window = GetAppWindow(window); |
| 71 if (app_window) | 71 if (app_window) |
| 72 last_active_window_ = app_window; | 72 last_active_window_ = app_window; |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool AppWindowLauncherItemController::IsOpen() const { | |
| 76 return !windows_.empty(); | |
| 77 } | |
| 78 | |
| 79 bool AppWindowLauncherItemController::IsVisible() const { | 75 bool AppWindowLauncherItemController::IsVisible() const { |
| 80 // Return true if any windows are visible. | 76 // Return true if any windows are visible. |
| 81 for (const auto* window : windows_) { | 77 for (const auto* window : windows_) { |
| 82 if (window->GetNativeWindow()->IsVisible()) | 78 if (window->GetNativeWindow()->IsVisible()) |
| 83 return true; | 79 return true; |
| 84 } | 80 } |
| 85 return false; | 81 return false; |
| 86 } | 82 } |
| 87 | 83 |
| 88 void AppWindowLauncherItemController::Launch(ash::LaunchSource source, | 84 void AppWindowLauncherItemController::Launch(ash::LaunchSource source, |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 if (window_to_show->IsActive()) { | 194 if (window_to_show->IsActive()) { |
| 199 // Coming here, only a single window is active. For keyboard activations | 195 // Coming here, only a single window is active. For keyboard activations |
| 200 // the window gets animated. | 196 // the window gets animated. |
| 201 AnimateWindow(window_to_show->GetNativeWindow(), | 197 AnimateWindow(window_to_show->GetNativeWindow(), |
| 202 wm::WINDOW_ANIMATION_TYPE_BOUNCE); | 198 wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
| 203 } else { | 199 } else { |
| 204 return ShowAndActivateOrMinimize(window_to_show); | 200 return ShowAndActivateOrMinimize(window_to_show); |
| 205 } | 201 } |
| 206 return kNoAction; | 202 return kNoAction; |
| 207 } | 203 } |
| OLD | NEW |