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/toplevel_window_event_handler.h" | 5 #include "ash/wm/toplevel_window_event_handler.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/resize_shadow_controller.h" | 8 #include "ash/wm/resize_shadow_controller.h" |
9 #include "ash/wm/window_resizer.h" | 9 #include "ash/wm/window_resizer.h" |
10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 event->StopPropagation(); | 328 event->StopPropagation(); |
329 } | 329 } |
330 | 330 |
331 aura::client::WindowMoveResult ToplevelWindowEventHandler::RunMoveLoop( | 331 aura::client::WindowMoveResult ToplevelWindowEventHandler::RunMoveLoop( |
332 aura::Window* source, | 332 aura::Window* source, |
333 const gfx::Vector2d& drag_offset, | 333 const gfx::Vector2d& drag_offset, |
334 aura::client::WindowMoveSource move_source) { | 334 aura::client::WindowMoveSource move_source) { |
335 DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. | 335 DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. |
336 in_move_loop_ = true; | 336 in_move_loop_ = true; |
337 move_cancelled_ = false; | 337 move_cancelled_ = false; |
338 aura::RootWindow* root_window = source->GetRootWindow(); | 338 aura::Window* root_window = source->GetRootWindow(); |
339 DCHECK(root_window); | 339 DCHECK(root_window); |
340 gfx::Point drag_location; | 340 gfx::Point drag_location; |
341 if (move_source == aura::client::WINDOW_MOVE_SOURCE_TOUCH && | 341 if (move_source == aura::client::WINDOW_MOVE_SOURCE_TOUCH && |
342 aura::Env::GetInstance()->is_touch_down()) { | 342 aura::Env::GetInstance()->is_touch_down()) { |
343 in_gesture_drag_ = true; | 343 in_gesture_drag_ = true; |
344 bool has_point = ui::GestureRecognizer::Get()-> | 344 bool has_point = ui::GestureRecognizer::Get()-> |
345 GetLastTouchPointForTarget(source, &drag_location); | 345 GetLastTouchPointForTarget(source, &drag_location); |
346 DCHECK(has_point); | 346 DCHECK(has_point); |
347 } else { | 347 } else { |
348 drag_location = root_window->GetLastMouseLocationInRoot(); | 348 drag_location = root_window->GetDispatcher()->GetLastMouseLocationInRoot(); |
349 aura::Window::ConvertPointToTarget( | 349 aura::Window::ConvertPointToTarget( |
350 root_window, source->parent(), &drag_location); | 350 root_window, source->parent(), &drag_location); |
351 } | 351 } |
352 // Set the cursor before calling CreateScopedWindowResizer(), as that will | 352 // Set the cursor before calling CreateScopedWindowResizer(), as that will |
353 // eventually call LockCursor() and prevent the cursor from changing. | 353 // eventually call LockCursor() and prevent the cursor from changing. |
354 aura::client::CursorClient* cursor_client = | 354 aura::client::CursorClient* cursor_client = |
355 aura::client::GetCursorClient(root_window); | 355 aura::client::GetCursorClient(root_window); |
356 if (cursor_client) | 356 if (cursor_client) |
357 cursor_client->SetCursor(ui::kCursorPointer); | 357 cursor_client->SetCursor(ui::kCursorPointer); |
358 CreateScopedWindowResizer(source, drag_location, HTCAPTION, move_source); | 358 CreateScopedWindowResizer(source, drag_location, HTCAPTION, move_source); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 529 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
530 // We explicitly don't invoke RevertDrag() since that may do things to window. | 530 // We explicitly don't invoke RevertDrag() since that may do things to window. |
531 // Instead we destroy the resizer. | 531 // Instead we destroy the resizer. |
532 window_resizer_.reset(); | 532 window_resizer_.reset(); |
533 | 533 |
534 // End the move loop. This does nothing if we're not in a move loop. | 534 // End the move loop. This does nothing if we're not in a move loop. |
535 EndMoveLoop(); | 535 EndMoveLoop(); |
536 } | 536 } |
537 | 537 |
538 } // namespace ash | 538 } // namespace ash |
OLD | NEW |