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/wm_toplevel_window_event_handler.h" | 5 #include "ash/wm/wm_toplevel_window_event_handler.h" |
6 | 6 |
| 7 #include "ash/shell_port.h" |
7 #include "ash/wm/window_resizer.h" | 8 #include "ash/wm/window_resizer.h" |
8 #include "ash/wm/window_state.h" | 9 #include "ash/wm/window_state.h" |
9 #include "ash/wm/window_state_observer.h" | 10 #include "ash/wm/window_state_observer.h" |
10 #include "ash/wm/wm_event.h" | 11 #include "ash/wm/wm_event.h" |
11 #include "ash/wm_shell.h" | |
12 #include "ash/wm_window.h" | 12 #include "ash/wm_window.h" |
13 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
15 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
16 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 const double kMinHorizVelocityForWindowSwipe = 1100; | 19 const double kMinHorizVelocityForWindowSwipe = 1100; |
20 const double kMinVertVelocityForWindowMinimize = 1000; | 20 const double kMinVertVelocityForWindowMinimize = 1000; |
21 } | 21 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 void WmToplevelWindowEventHandler::ScopedWindowResizer::OnWindowDestroying( | 132 void WmToplevelWindowEventHandler::ScopedWindowResizer::OnWindowDestroying( |
133 aura::Window* window) { | 133 aura::Window* window) { |
134 DCHECK_EQ(resizer_->GetTarget(), WmWindow::Get(window)); | 134 DCHECK_EQ(resizer_->GetTarget(), WmWindow::Get(window)); |
135 handler_->ResizerWindowDestroyed(); | 135 handler_->ResizerWindowDestroyed(); |
136 } | 136 } |
137 | 137 |
138 // WmToplevelWindowEventHandler | 138 // WmToplevelWindowEventHandler |
139 // -------------------------------------------------- | 139 // -------------------------------------------------- |
140 | 140 |
141 WmToplevelWindowEventHandler::WmToplevelWindowEventHandler(WmShell* shell) | 141 WmToplevelWindowEventHandler::WmToplevelWindowEventHandler() |
142 : shell_(shell), first_finger_hittest_(HTNOWHERE) { | 142 : first_finger_hittest_(HTNOWHERE) { |
143 shell_->AddDisplayObserver(this); | 143 ShellPort::Get()->AddDisplayObserver(this); |
144 } | 144 } |
145 | 145 |
146 WmToplevelWindowEventHandler::~WmToplevelWindowEventHandler() { | 146 WmToplevelWindowEventHandler::~WmToplevelWindowEventHandler() { |
147 shell_->RemoveDisplayObserver(this); | 147 ShellPort::Get()->RemoveDisplayObserver(this); |
148 } | 148 } |
149 | 149 |
150 void WmToplevelWindowEventHandler::OnKeyEvent(ui::KeyEvent* event) { | 150 void WmToplevelWindowEventHandler::OnKeyEvent(ui::KeyEvent* event) { |
151 if (window_resizer_.get() && event->type() == ui::ET_KEY_PRESSED && | 151 if (window_resizer_.get() && event->type() == ui::ET_KEY_PRESSED && |
152 event->key_code() == ui::VKEY_ESCAPE) { | 152 event->key_code() == ui::VKEY_ESCAPE) { |
153 CompleteDrag(DragResult::REVERT); | 153 CompleteDrag(DragResult::REVERT); |
154 } | 154 } |
155 } | 155 } |
156 | 156 |
157 void WmToplevelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event, | 157 void WmToplevelWindowEventHandler::OnMouseEvent(ui::MouseEvent* event, |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 void WmToplevelWindowEventHandler::ResizerWindowDestroyed() { | 541 void WmToplevelWindowEventHandler::ResizerWindowDestroyed() { |
542 CompleteDrag(DragResult::WINDOW_DESTROYED); | 542 CompleteDrag(DragResult::WINDOW_DESTROYED); |
543 } | 543 } |
544 | 544 |
545 void WmToplevelWindowEventHandler::OnDisplayConfigurationChanging() { | 545 void WmToplevelWindowEventHandler::OnDisplayConfigurationChanging() { |
546 CompleteDrag(DragResult::REVERT); | 546 CompleteDrag(DragResult::REVERT); |
547 } | 547 } |
548 | 548 |
549 } // namespace wm | 549 } // namespace wm |
550 } // namespace ash | 550 } // namespace ash |
OLD | NEW |