OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell_window_launcher_item_controller.h
" | 5 #include "chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h
" |
6 | 6 |
7 #include "apps/native_app_window.h" | 7 #include "apps/native_app_window.h" |
8 #include "apps/shell_window.h" | 8 #include "apps/shell_window.h" |
9 #include "ash/wm/window_settings.h" | 9 #include "ash/wm/window_state.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" | 11 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item.h" |
12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h" | 12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_app_menu_item_v2app.h" |
13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" | 13 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
14 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" | 14 #include "chrome/browser/ui/ash/launcher/launcher_item_controller.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "ui/aura/client/aura_constants.h" | 16 #include "ui/aura/client/aura_constants.h" |
17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
18 #include "ui/events/event.h" | 18 #include "ui/events/event.h" |
19 #include "ui/views/corewm/window_animations.h" | 19 #include "ui/views/corewm/window_animations.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 void ShellWindowLauncherItemController::Clicked(const ui::Event& event) { | 141 void ShellWindowLauncherItemController::Clicked(const ui::Event& event) { |
142 if (shell_windows_.empty()) | 142 if (shell_windows_.empty()) |
143 return; | 143 return; |
144 if (type() == TYPE_APP_PANEL) { | 144 if (type() == TYPE_APP_PANEL) { |
145 DCHECK(shell_windows_.size() == 1); | 145 DCHECK(shell_windows_.size() == 1); |
146 ShellWindow* panel = shell_windows_.front(); | 146 ShellWindow* panel = shell_windows_.front(); |
147 aura::Window* panel_window = panel->GetNativeWindow(); | 147 aura::Window* panel_window = panel->GetNativeWindow(); |
148 // If the panel is attached on another display, move it to the current | 148 // If the panel is attached on another display, move it to the current |
149 // display and activate it. | 149 // display and activate it. |
150 if (ash::wm::GetWindowSettings(panel_window)->panel_attached() && | 150 if (ash::wm::GetWindowState(panel_window)->panel_attached() && |
151 ash::wm::MoveWindowToEventRoot(panel_window, event)) { | 151 ash::wm::MoveWindowToEventRoot(panel_window, event)) { |
152 if (!panel->GetBaseWindow()->IsActive()) | 152 if (!panel->GetBaseWindow()->IsActive()) |
153 ShowAndActivateOrMinimize(panel); | 153 ShowAndActivateOrMinimize(panel); |
154 } else { | 154 } else { |
155 ShowAndActivateOrMinimize(panel); | 155 ShowAndActivateOrMinimize(panel); |
156 } | 156 } |
157 } else { | 157 } else { |
158 ShellWindow* window_to_show = last_active_shell_window_ ? | 158 ShellWindow* window_to_show = last_active_shell_window_ ? |
159 last_active_shell_window_ : shell_windows_.front(); | 159 last_active_shell_window_ : shell_windows_.front(); |
160 // If the event was triggered by a keystroke, we try to advance to the next | 160 // If the event was triggered by a keystroke, we try to advance to the next |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 if (window_to_show->GetBaseWindow()->IsActive()) { | 238 if (window_to_show->GetBaseWindow()->IsActive()) { |
239 // Coming here, only a single window is active. For keyboard activations | 239 // Coming here, only a single window is active. For keyboard activations |
240 // the window gets animated. | 240 // the window gets animated. |
241 AnimateWindow(window_to_show->GetNativeWindow(), | 241 AnimateWindow(window_to_show->GetNativeWindow(), |
242 views::corewm::WINDOW_ANIMATION_TYPE_BOUNCE); | 242 views::corewm::WINDOW_ANIMATION_TYPE_BOUNCE); |
243 } else { | 243 } else { |
244 ShowAndActivateOrMinimize(window_to_show); | 244 ShowAndActivateOrMinimize(window_to_show); |
245 } | 245 } |
246 } | 246 } |
OLD | NEW |