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 "ash/wm/drag_window_resizer.h" | 5 #include "ash/wm/drag_window_resizer.h" |
6 | 6 |
7 #include "ash/display/mouse_cursor_event_filter.h" | 7 #include "ash/display/mouse_cursor_event_filter.h" |
8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 drag_window_controller_->SetOpacity(phantom_opacity); | 225 drag_window_controller_->SetOpacity(phantom_opacity); |
226 GetTarget()->layer()->SetOpacity(window_opacity); | 226 GetTarget()->layer()->SetOpacity(window_opacity); |
227 } else { | 227 } else { |
228 drag_window_controller_.reset(); | 228 drag_window_controller_.reset(); |
229 GetTarget()->layer()->SetOpacity(1.0f); | 229 GetTarget()->layer()->SetOpacity(1.0f); |
230 } | 230 } |
231 } | 231 } |
232 | 232 |
233 bool DragWindowResizer::ShouldAllowMouseWarp() { | 233 bool DragWindowResizer::ShouldAllowMouseWarp() { |
234 return (details_.window_component == HTCAPTION) && | 234 return (details_.window_component == HTCAPTION) && |
235 !GetTarget()->transient_parent() && | 235 !GetTarget()->transient_parent() && |
236 (GetTarget()->type() == aura::client::WINDOW_TYPE_NORMAL || | 236 (GetTarget()->type() == ui::wm::WINDOW_TYPE_NORMAL || |
237 GetTarget()->type() == aura::client::WINDOW_TYPE_PANEL); | 237 GetTarget()->type() == ui::wm::WINDOW_TYPE_PANEL); |
238 } | 238 } |
239 | 239 |
240 TrayUser* DragWindowResizer::GetTrayUserItemAtPoint( | 240 TrayUser* DragWindowResizer::GetTrayUserItemAtPoint( |
241 const gfx::Point& point_in_screen) { | 241 const gfx::Point& point_in_screen) { |
242 // Unit tests might not have an ash shell. | 242 // Unit tests might not have an ash shell. |
243 if (!ash::Shell::GetInstance()) | 243 if (!ash::Shell::GetInstance()) |
244 return NULL; | 244 return NULL; |
245 | 245 |
246 // Check that this is a drag move operation from a suitable window. | 246 // Check that this is a drag move operation from a suitable window. |
247 if (details_.window_component != HTCAPTION || | 247 if (details_.window_component != HTCAPTION || |
248 GetTarget()->transient_parent() || | 248 GetTarget()->transient_parent() || |
249 (GetTarget()->type() != aura::client::WINDOW_TYPE_NORMAL && | 249 (GetTarget()->type() != ui::wm::WINDOW_TYPE_NORMAL && |
250 GetTarget()->type() != aura::client::WINDOW_TYPE_PANEL && | 250 GetTarget()->type() != ui::wm::WINDOW_TYPE_PANEL && |
251 GetTarget()->type() != aura::client::WINDOW_TYPE_POPUP)) | 251 GetTarget()->type() != ui::wm::WINDOW_TYPE_POPUP)) |
252 return NULL; | 252 return NULL; |
253 | 253 |
254 // We only allow to drag the window onto a tray of it's own RootWindow. | 254 // We only allow to drag the window onto a tray of it's own RootWindow. |
255 SystemTray* tray = internal::GetRootWindowController( | 255 SystemTray* tray = internal::GetRootWindowController( |
256 details_.window->GetRootWindow())->GetSystemTray(); | 256 details_.window->GetRootWindow())->GetSystemTray(); |
257 | 257 |
258 // Again - unit tests might not have a tray. | 258 // Again - unit tests might not have a tray. |
259 if (!tray) | 259 if (!tray) |
260 return NULL; | 260 return NULL; |
261 | 261 |
(...skipping 26 matching lines...) Expand all Loading... |
288 if (!tray_user->TransferWindowToUser(details_.window)) { | 288 if (!tray_user->TransferWindowToUser(details_.window)) { |
289 GetTarget()->layer()->SetOpacity(old_opacity); | 289 GetTarget()->layer()->SetOpacity(old_opacity); |
290 return false; | 290 return false; |
291 } | 291 } |
292 RevertDrag(); | 292 RevertDrag(); |
293 return true; | 293 return true; |
294 } | 294 } |
295 | 295 |
296 } // namespace internal | 296 } // namespace internal |
297 } // namespace ash | 297 } // namespace ash |
OLD | NEW |