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/aura/wm_window_aura.h" | 7 #include "ash/aura/wm_window_aura.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 aura::Window* source, | 46 aura::Window* source, |
47 const gfx::Vector2d& drag_offset, | 47 const gfx::Vector2d& drag_offset, |
48 aura::client::WindowMoveSource move_source) { | 48 aura::client::WindowMoveSource move_source) { |
49 DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. | 49 DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. |
50 aura::Window* root_window = source->GetRootWindow(); | 50 aura::Window* root_window = source->GetRootWindow(); |
51 DCHECK(root_window); | 51 DCHECK(root_window); |
52 gfx::Point drag_location; | 52 gfx::Point drag_location; |
53 if (move_source == aura::client::WINDOW_MOVE_SOURCE_TOUCH && | 53 if (move_source == aura::client::WINDOW_MOVE_SOURCE_TOUCH && |
54 aura::Env::GetInstance()->is_touch_down()) { | 54 aura::Env::GetInstance()->is_touch_down()) { |
55 gfx::PointF drag_location_f; | 55 gfx::PointF drag_location_f; |
56 bool has_point = ui::GestureRecognizer::Get()-> | 56 bool has_point = ui::GestureRecognizer::Get()->GetLastTouchPointForTarget( |
57 GetLastTouchPointForTarget(source, &drag_location_f); | 57 source, &drag_location_f); |
58 drag_location = gfx::ToFlooredPoint(drag_location_f); | 58 drag_location = gfx::ToFlooredPoint(drag_location_f); |
59 DCHECK(has_point); | 59 DCHECK(has_point); |
60 } else { | 60 } else { |
61 drag_location = | 61 drag_location = |
62 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); | 62 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); |
63 aura::Window::ConvertPointToTarget( | 63 aura::Window::ConvertPointToTarget(root_window, source->parent(), |
64 root_window, source->parent(), &drag_location); | 64 &drag_location); |
65 } | 65 } |
66 // Set the cursor before calling AttemptToStartDrag(), as that will | 66 // Set the cursor before calling AttemptToStartDrag(), as that will |
67 // eventually call LockCursor() and prevent the cursor from changing. | 67 // eventually call LockCursor() and prevent the cursor from changing. |
68 aura::client::CursorClient* cursor_client = | 68 aura::client::CursorClient* cursor_client = |
69 aura::client::GetCursorClient(root_window); | 69 aura::client::GetCursorClient(root_window); |
70 if (cursor_client) | 70 if (cursor_client) |
71 cursor_client->SetCursor(ui::kCursorPointer); | 71 cursor_client->SetCursor(ui::kCursorPointer); |
72 | 72 |
73 base::RunLoop run_loop; | 73 base::RunLoop run_loop; |
74 | 74 |
(...skipping 30 matching lines...) Expand all Loading... |
105 | 105 |
106 void ToplevelWindowEventHandler::OnDragCompleted( | 106 void ToplevelWindowEventHandler::OnDragCompleted( |
107 wm::WmToplevelWindowEventHandler::DragResult* result_return_value, | 107 wm::WmToplevelWindowEventHandler::DragResult* result_return_value, |
108 base::RunLoop* run_loop, | 108 base::RunLoop* run_loop, |
109 wm::WmToplevelWindowEventHandler::DragResult result) { | 109 wm::WmToplevelWindowEventHandler::DragResult result) { |
110 *result_return_value = result; | 110 *result_return_value = result; |
111 run_loop->Quit(); | 111 run_loop->Quit(); |
112 } | 112 } |
113 | 113 |
114 } // namespace ash | 114 } // namespace ash |
OLD | NEW |