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/property_util.h" | 8 #include "ash/wm/property_util.h" |
9 #include "ash/wm/resize_shadow_controller.h" | 9 #include "ash/wm/resize_shadow_controller.h" |
10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 owner->AddPreTargetHandler(this); | 116 owner->AddPreTargetHandler(this); |
117 owner->AddPostTargetHandler(this); | 117 owner->AddPostTargetHandler(this); |
118 } | 118 } |
119 | 119 |
120 ToplevelWindowEventHandler::~ToplevelWindowEventHandler() { | 120 ToplevelWindowEventHandler::~ToplevelWindowEventHandler() { |
121 Shell::GetInstance()->display_controller()->RemoveObserver(this); | 121 Shell::GetInstance()->display_controller()->RemoveObserver(this); |
122 if (destroyed_) | 122 if (destroyed_) |
123 *destroyed_ = true; | 123 *destroyed_ = true; |
124 } | 124 } |
125 | 125 |
126 ui::EventResult ToplevelWindowEventHandler::OnKeyEvent(ui::KeyEvent* event) { | 126 void ToplevelWindowEventHandler::OnKeyEvent(ui::KeyEvent* event) { |
127 if (window_resizer_.get() && event->type() == ui::ET_KEY_PRESSED && | 127 if (window_resizer_.get() && event->type() == ui::ET_KEY_PRESSED && |
128 event->key_code() == ui::VKEY_ESCAPE) { | 128 event->key_code() == ui::VKEY_ESCAPE) { |
129 CompleteDrag(DRAG_REVERT, event->flags()); | 129 CompleteDrag(DRAG_REVERT, event->flags()); |
130 } | 130 } |
131 return ui::ER_UNHANDLED; | |
132 } | 131 } |
133 | 132 |
134 ui::EventResult ToplevelWindowEventHandler::OnMouseEvent( | 133 ui::EventResult ToplevelWindowEventHandler::OnMouseEvent( |
135 ui::MouseEvent* event) { | 134 ui::MouseEvent* event) { |
136 if ((event->flags() & | 135 if ((event->flags() & |
137 (ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)) != 0) | 136 (ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON)) != 0) |
138 return ui::ER_UNHANDLED; | 137 return ui::ER_UNHANDLED; |
139 | 138 |
140 aura::Window* target = static_cast<aura::Window*>(event->target()); | 139 aura::Window* target = static_cast<aura::Window*>(event->target()); |
141 switch (event->type()) { | 140 switch (event->type()) { |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 435 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
437 // We explicitly don't invoke RevertDrag() since that may do things to window. | 436 // We explicitly don't invoke RevertDrag() since that may do things to window. |
438 // Instead we destroy the resizer. | 437 // Instead we destroy the resizer. |
439 window_resizer_.reset(); | 438 window_resizer_.reset(); |
440 | 439 |
441 // End the move loop. This does nothing if we're not in a move loop. | 440 // End the move loop. This does nothing if we're not in a move loop. |
442 EndMoveLoop(); | 441 EndMoveLoop(); |
443 } | 442 } |
444 | 443 |
445 } // namespace ash | 444 } // namespace ash |
OLD | NEW |