| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 bool IsMove() const; | 97 bool IsMove() const; |
| 98 | 98 |
| 99 WindowResizer* resizer() { return resizer_.get(); } | 99 WindowResizer* resizer() { return resizer_.get(); } |
| 100 | 100 |
| 101 // WindowObserver overrides: | 101 // WindowObserver overrides: |
| 102 virtual void OnWindowHierarchyChanging( | 102 virtual void OnWindowHierarchyChanging( |
| 103 const HierarchyChangeParams& params) OVERRIDE; | 103 const HierarchyChangeParams& params) OVERRIDE; |
| 104 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 104 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 105 | 105 |
| 106 // WindowStateObserver overrides: | 106 // WindowStateObserver overrides: |
| 107 virtual void OnWindowShowTypeChanged(wm::WindowState* window_state, | 107 virtual void OnPreWindowShowTypeChange(wm::WindowState* window_state, |
| 108 wm::WindowShowType type) OVERRIDE; | 108 wm::WindowShowType type) OVERRIDE; |
| 109 | 109 |
| 110 private: | 110 private: |
| 111 ToplevelWindowEventHandler* handler_; | 111 ToplevelWindowEventHandler* handler_; |
| 112 scoped_ptr<WindowResizer> resizer_; | 112 scoped_ptr<WindowResizer> resizer_; |
| 113 | 113 |
| 114 DISALLOW_COPY_AND_ASSIGN(ScopedWindowResizer); | 114 DISALLOW_COPY_AND_ASSIGN(ScopedWindowResizer); |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 ToplevelWindowEventHandler::ScopedWindowResizer::ScopedWindowResizer( | 117 ToplevelWindowEventHandler::ScopedWindowResizer::ScopedWindowResizer( |
| 118 ToplevelWindowEventHandler* handler, | 118 ToplevelWindowEventHandler* handler, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 137 const HierarchyChangeParams& params) { | 137 const HierarchyChangeParams& params) { |
| 138 if (params.receiver != resizer_->GetTarget()) | 138 if (params.receiver != resizer_->GetTarget()) |
| 139 return; | 139 return; |
| 140 wm::WindowState* state = wm::GetWindowState(params.receiver); | 140 wm::WindowState* state = wm::GetWindowState(params.receiver); |
| 141 if (state->continue_drag_after_reparent()) | 141 if (state->continue_drag_after_reparent()) |
| 142 state->set_continue_drag_after_reparent(false); | 142 state->set_continue_drag_after_reparent(false); |
| 143 else | 143 else |
| 144 handler_->CompleteDrag(DRAG_COMPLETE); | 144 handler_->CompleteDrag(DRAG_COMPLETE); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowShowTypeChanged( | 147 void |
| 148 ToplevelWindowEventHandler::ScopedWindowResizer::OnPreWindowShowTypeChange( |
| 148 wm::WindowState* window_state, | 149 wm::WindowState* window_state, |
| 149 wm::WindowShowType old) { | 150 wm::WindowShowType old) { |
| 150 handler_->CompleteDrag(DRAG_COMPLETE); | 151 handler_->CompleteDrag(DRAG_COMPLETE); |
| 151 } | 152 } |
| 152 | 153 |
| 153 void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowDestroying( | 154 void ToplevelWindowEventHandler::ScopedWindowResizer::OnWindowDestroying( |
| 154 aura::Window* window) { | 155 aura::Window* window) { |
| 155 DCHECK_EQ(resizer_->GetTarget(), window); | 156 DCHECK_EQ(resizer_->GetTarget(), window); |
| 156 handler_->ResizerWindowDestroyed(); | 157 handler_->ResizerWindowDestroyed(); |
| 157 } | 158 } |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 605 |
| 605 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 606 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
| 606 // We explicitly don't invoke RevertDrag() since that may do things to window. | 607 // We explicitly don't invoke RevertDrag() since that may do things to window. |
| 607 // Instead we destroy the resizer. | 608 // Instead we destroy the resizer. |
| 608 window_resizer_.reset(); | 609 window_resizer_.reset(); |
| 609 | 610 |
| 610 CompleteDrag(DRAG_REVERT); | 611 CompleteDrag(DRAG_REVERT); |
| 611 } | 612 } |
| 612 | 613 |
| 613 } // namespace ash | 614 } // namespace ash |
| OLD | NEW |