| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 } | 225 } |
| 226 return; | 226 return; |
| 227 } | 227 } |
| 228 | 228 |
| 229 switch (event->type()) { | 229 switch (event->type()) { |
| 230 case ui::ET_GESTURE_TAP_DOWN: { | 230 case ui::ET_GESTURE_TAP_DOWN: { |
| 231 int component = GetWindowComponent(target, *event); | 231 int component = GetWindowComponent(target, *event); |
| 232 if (!(WindowResizer::GetBoundsChangeForWindowComponent(component) & | 232 if (!(WindowResizer::GetBoundsChangeForWindowComponent(component) & |
| 233 WindowResizer::kBoundsChange_Resizes)) | 233 WindowResizer::kBoundsChange_Resizes)) |
| 234 return; | 234 return; |
| 235 internal::ResizeShadowController* controller = | 235 ResizeShadowController* controller = |
| 236 Shell::GetInstance()->resize_shadow_controller(); | 236 Shell::GetInstance()->resize_shadow_controller(); |
| 237 if (controller) | 237 if (controller) |
| 238 controller->ShowShadow(target, component); | 238 controller->ShowShadow(target, component); |
| 239 return; | 239 return; |
| 240 } | 240 } |
| 241 case ui::ET_GESTURE_END: { | 241 case ui::ET_GESTURE_END: { |
| 242 internal::ResizeShadowController* controller = | 242 ResizeShadowController* controller = |
| 243 Shell::GetInstance()->resize_shadow_controller(); | 243 Shell::GetInstance()->resize_shadow_controller(); |
| 244 if (controller) | 244 if (controller) |
| 245 controller->HideShadow(target); | 245 controller->HideShadow(target); |
| 246 | 246 |
| 247 if (window_resizer_.get() && | 247 if (window_resizer_.get() && |
| 248 (event->details().touch_points() == 1 || | 248 (event->details().touch_points() == 1 || |
| 249 !CanStartOneFingerDrag(first_finger_hittest_))) { | 249 !CanStartOneFingerDrag(first_finger_hittest_))) { |
| 250 CompleteDrag(DRAG_COMPLETE); | 250 CompleteDrag(DRAG_COMPLETE); |
| 251 event->StopPropagation(); | 251 event->StopPropagation(); |
| 252 } | 252 } |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 aura::Window* target, | 525 aura::Window* target, |
| 526 ui::LocatedEvent* event) { | 526 ui::LocatedEvent* event) { |
| 527 // Shadow effects are applied after target handling. Note that we don't | 527 // Shadow effects are applied after target handling. Note that we don't |
| 528 // respect ER_HANDLED here right now since we have not had a reason to allow | 528 // respect ER_HANDLED here right now since we have not had a reason to allow |
| 529 // the target to cancel shadow rendering. | 529 // the target to cancel shadow rendering. |
| 530 if (event->phase() != ui::EP_POSTTARGET || !target->delegate()) | 530 if (event->phase() != ui::EP_POSTTARGET || !target->delegate()) |
| 531 return; | 531 return; |
| 532 | 532 |
| 533 // TODO(jamescook): Move the resize cursor update code into here from | 533 // TODO(jamescook): Move the resize cursor update code into here from |
| 534 // CompoundEventFilter? | 534 // CompoundEventFilter? |
| 535 internal::ResizeShadowController* controller = | 535 ResizeShadowController* controller = |
| 536 Shell::GetInstance()->resize_shadow_controller(); | 536 Shell::GetInstance()->resize_shadow_controller(); |
| 537 if (controller) { | 537 if (controller) { |
| 538 if (event->flags() & ui::EF_IS_NON_CLIENT) { | 538 if (event->flags() & ui::EF_IS_NON_CLIENT) { |
| 539 int component = | 539 int component = |
| 540 target->delegate()->GetNonClientComponent(event->location()); | 540 target->delegate()->GetNonClientComponent(event->location()); |
| 541 controller->ShowShadow(target, component); | 541 controller->ShowShadow(target, component); |
| 542 } else { | 542 } else { |
| 543 controller->HideShadow(target); | 543 controller->HideShadow(target); |
| 544 } | 544 } |
| 545 } | 545 } |
| 546 } | 546 } |
| 547 | 547 |
| 548 void ToplevelWindowEventHandler::HandleMouseExited( | 548 void ToplevelWindowEventHandler::HandleMouseExited( |
| 549 aura::Window* target, | 549 aura::Window* target, |
| 550 ui::LocatedEvent* event) { | 550 ui::LocatedEvent* event) { |
| 551 // Shadow effects are applied after target handling. Note that we don't | 551 // Shadow effects are applied after target handling. Note that we don't |
| 552 // respect ER_HANDLED here right now since we have not had a reason to allow | 552 // respect ER_HANDLED here right now since we have not had a reason to allow |
| 553 // the target to cancel shadow rendering. | 553 // the target to cancel shadow rendering. |
| 554 if (event->phase() != ui::EP_POSTTARGET) | 554 if (event->phase() != ui::EP_POSTTARGET) |
| 555 return; | 555 return; |
| 556 | 556 |
| 557 internal::ResizeShadowController* controller = | 557 ResizeShadowController* controller = |
| 558 Shell::GetInstance()->resize_shadow_controller(); | 558 Shell::GetInstance()->resize_shadow_controller(); |
| 559 if (controller) | 559 if (controller) |
| 560 controller->HideShadow(target); | 560 controller->HideShadow(target); |
| 561 } | 561 } |
| 562 | 562 |
| 563 void ToplevelWindowEventHandler::SetWindowStateTypeFromGesture( | 563 void ToplevelWindowEventHandler::SetWindowStateTypeFromGesture( |
| 564 aura::Window* window, | 564 aura::Window* window, |
| 565 wm::WindowStateType new_state_type) { | 565 wm::WindowStateType new_state_type) { |
| 566 wm::WindowState* window_state = ash::wm::GetWindowState(window); | 566 wm::WindowState* window_state = ash::wm::GetWindowState(window); |
| 567 // TODO(oshima): Move extra logic (set_unminimize_to_restore_bounds, | 567 // TODO(oshima): Move extra logic (set_unminimize_to_restore_bounds, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 602 |
| 603 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 603 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
| 604 // We explicitly don't invoke RevertDrag() since that may do things to window. | 604 // We explicitly don't invoke RevertDrag() since that may do things to window. |
| 605 // Instead we destroy the resizer. | 605 // Instead we destroy the resizer. |
| 606 window_resizer_.reset(); | 606 window_resizer_.reset(); |
| 607 | 607 |
| 608 CompleteDrag(DRAG_REVERT); | 608 CompleteDrag(DRAG_REVERT); |
| 609 } | 609 } |
| 610 | 610 |
| 611 } // namespace ash | 611 } // namespace ash |
| OLD | NEW |