Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: ash/wm/toplevel_window_event_handler.cc

Issue 2629643002: chromeos: Renames WmWindowAura to WmWindow (Closed)
Patch Set: unnecessary casts Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
8 #include "ash/common/wm/window_state.h" 7 #include "ash/common/wm/window_state.h"
8 #include "ash/common/wm_window.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/wm/window_state_aura.h" 10 #include "ash/wm/window_state_aura.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "ui/aura/client/cursor_client.h" 13 #include "ui/aura/client/cursor_client.h"
14 #include "ui/aura/env.h" 14 #include "ui/aura/env.h"
15 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
16 #include "ui/aura/window_event_dispatcher.h" 16 #include "ui/aura/window_event_dispatcher.h"
17 #include "ui/aura/window_tracker.h" 17 #include "ui/aura/window_tracker.h"
18 #include "ui/aura/window_tree_host.h" 18 #include "ui/aura/window_tree_host.h"
19 #include "ui/base/cursor/cursor.h" 19 #include "ui/base/cursor/cursor.h"
20 #include "ui/base/hit_test.h" 20 #include "ui/base/hit_test.h"
21 #include "ui/events/event.h" 21 #include "ui/events/event.h"
22 #include "ui/events/event_utils.h" 22 #include "ui/events/event_utils.h"
23 #include "ui/events/gestures/gesture_recognizer.h" 23 #include "ui/events/gestures/gesture_recognizer.h"
24 24
25 namespace ash { 25 namespace ash {
26 26
27 ToplevelWindowEventHandler::ToplevelWindowEventHandler(WmShell* shell) 27 ToplevelWindowEventHandler::ToplevelWindowEventHandler(WmShell* shell)
28 : wm_toplevel_window_event_handler_(shell), weak_factory_(this) {} 28 : wm_toplevel_window_event_handler_(shell), weak_factory_(this) {}
29 29
30 ToplevelWindowEventHandler::~ToplevelWindowEventHandler() {} 30 ToplevelWindowEventHandler::~ToplevelWindowEventHandler() {}
31 31
32 void ToplevelWindowEventHandler::OnKeyEvent(ui::KeyEvent* event) { 32 void ToplevelWindowEventHandler::OnKeyEvent(ui::KeyEvent* event) {
33 wm_toplevel_window_event_handler_.OnKeyEvent(event); 33 wm_toplevel_window_event_handler_.OnKeyEvent(event);
34 } 34 }
35 35
36 void ToplevelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event) { 36 void ToplevelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event) {
37 aura::Window* target = static_cast<aura::Window*>(event->target()); 37 aura::Window* target = static_cast<aura::Window*>(event->target());
38 wm_toplevel_window_event_handler_.OnMouseEvent(event, 38 wm_toplevel_window_event_handler_.OnMouseEvent(event, WmWindow::Get(target));
39 WmWindowAura::Get(target));
40 } 39 }
41 40
42 void ToplevelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) { 41 void ToplevelWindowEventHandler::OnGestureEvent(ui::GestureEvent* event) {
43 aura::Window* target = static_cast<aura::Window*>(event->target()); 42 aura::Window* target = static_cast<aura::Window*>(event->target());
44 wm_toplevel_window_event_handler_.OnGestureEvent(event, 43 wm_toplevel_window_event_handler_.OnGestureEvent(event,
45 WmWindowAura::Get(target)); 44 WmWindow::Get(target));
46 } 45 }
47 46
48 aura::client::WindowMoveResult ToplevelWindowEventHandler::RunMoveLoop( 47 aura::client::WindowMoveResult ToplevelWindowEventHandler::RunMoveLoop(
49 aura::Window* source, 48 aura::Window* source,
50 const gfx::Vector2d& drag_offset, 49 const gfx::Vector2d& drag_offset,
51 aura::client::WindowMoveSource move_source) { 50 aura::client::WindowMoveSource move_source) {
52 DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. 51 DCHECK(!in_move_loop_); // Can only handle one nested loop at a time.
53 aura::Window* root_window = source->GetRootWindow(); 52 aura::Window* root_window = source->GetRootWindow();
54 DCHECK(root_window); 53 DCHECK(root_window);
55 gfx::Point drag_location; 54 gfx::Point drag_location;
(...skipping 15 matching lines...) Expand all
71 aura::client::CursorClient* cursor_client = 70 aura::client::CursorClient* cursor_client =
72 aura::client::GetCursorClient(root_window); 71 aura::client::GetCursorClient(root_window);
73 if (cursor_client) 72 if (cursor_client)
74 cursor_client->SetCursor(ui::kCursorPointer); 73 cursor_client->SetCursor(ui::kCursorPointer);
75 74
76 base::RunLoop run_loop; 75 base::RunLoop run_loop;
77 76
78 wm::WmToplevelWindowEventHandler::DragResult result = 77 wm::WmToplevelWindowEventHandler::DragResult result =
79 wm::WmToplevelWindowEventHandler::DragResult::SUCCESS; 78 wm::WmToplevelWindowEventHandler::DragResult::SUCCESS;
80 if (!wm_toplevel_window_event_handler_.AttemptToStartDrag( 79 if (!wm_toplevel_window_event_handler_.AttemptToStartDrag(
81 WmWindowAura::Get(source), drag_location, HTCAPTION, move_source, 80 WmWindow::Get(source), drag_location, HTCAPTION, move_source,
82 base::Bind(&ToplevelWindowEventHandler::OnDragCompleted, 81 base::Bind(&ToplevelWindowEventHandler::OnDragCompleted,
83 weak_factory_.GetWeakPtr(), &result, &run_loop))) { 82 weak_factory_.GetWeakPtr(), &result, &run_loop))) {
84 return aura::client::MOVE_CANCELED; 83 return aura::client::MOVE_CANCELED;
85 } 84 }
86 85
87 in_move_loop_ = true; 86 in_move_loop_ = true;
88 base::WeakPtr<ToplevelWindowEventHandler> weak_ptr( 87 base::WeakPtr<ToplevelWindowEventHandler> weak_ptr(
89 weak_factory_.GetWeakPtr()); 88 weak_factory_.GetWeakPtr());
90 base::MessageLoop* loop = base::MessageLoop::current(); 89 base::MessageLoop* loop = base::MessageLoop::current();
91 base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop); 90 base::MessageLoop::ScopedNestableTaskAllower allow_nested(loop);
(...skipping 27 matching lines...) Expand all
119 118
120 void ToplevelWindowEventHandler::OnDragCompleted( 119 void ToplevelWindowEventHandler::OnDragCompleted(
121 wm::WmToplevelWindowEventHandler::DragResult* result_return_value, 120 wm::WmToplevelWindowEventHandler::DragResult* result_return_value,
122 base::RunLoop* run_loop, 121 base::RunLoop* run_loop,
123 wm::WmToplevelWindowEventHandler::DragResult result) { 122 wm::WmToplevelWindowEventHandler::DragResult result) {
124 *result_return_value = result; 123 *result_return_value = result;
125 run_loop->Quit(); 124 run_loop->Quit();
126 } 125 }
127 126
128 } // namespace ash 127 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698