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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 // WindowObserver overrides: | 102 // WindowObserver overrides: |
103 void OnWindowDestroying(aura::Window* window) override; | 103 void OnWindowDestroying(aura::Window* window) override; |
104 | 104 |
105 // WindowStateObserver overrides: | 105 // WindowStateObserver overrides: |
106 void OnPreWindowStateTypeChange(wm::WindowState* window_state, | 106 void OnPreWindowStateTypeChange(wm::WindowState* window_state, |
107 wm::WindowStateType type) override; | 107 wm::WindowStateType type) override; |
108 | 108 |
109 private: | 109 private: |
110 ToplevelWindowEventHandler* handler_; | 110 ToplevelWindowEventHandler* handler_; |
111 scoped_ptr<WindowResizer> resizer_; | 111 std::unique_ptr<WindowResizer> resizer_; |
112 | 112 |
113 // Whether ScopedWindowResizer grabbed capture. | 113 // Whether ScopedWindowResizer grabbed capture. |
114 bool grabbed_capture_; | 114 bool grabbed_capture_; |
115 | 115 |
116 DISALLOW_COPY_AND_ASSIGN(ScopedWindowResizer); | 116 DISALLOW_COPY_AND_ASSIGN(ScopedWindowResizer); |
117 }; | 117 }; |
118 | 118 |
119 ToplevelWindowEventHandler::ScopedWindowResizer::ScopedWindowResizer( | 119 ToplevelWindowEventHandler::ScopedWindowResizer::ScopedWindowResizer( |
120 ToplevelWindowEventHandler* handler, | 120 ToplevelWindowEventHandler* handler, |
121 WindowResizer* resizer) | 121 WindowResizer* resizer) |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 459 |
460 pre_drag_window_bounds_ = window->bounds(); | 460 pre_drag_window_bounds_ = window->bounds(); |
461 in_gesture_drag_ = (source == aura::client::WINDOW_MOVE_SOURCE_TOUCH); | 461 in_gesture_drag_ = (source == aura::client::WINDOW_MOVE_SOURCE_TOUCH); |
462 return true; | 462 return true; |
463 } | 463 } |
464 | 464 |
465 bool ToplevelWindowEventHandler::CompleteDrag(DragCompletionStatus status) { | 465 bool ToplevelWindowEventHandler::CompleteDrag(DragCompletionStatus status) { |
466 if (!window_resizer_) | 466 if (!window_resizer_) |
467 return false; | 467 return false; |
468 | 468 |
469 scoped_ptr<ScopedWindowResizer> resizer(window_resizer_.release()); | 469 std::unique_ptr<ScopedWindowResizer> resizer(window_resizer_.release()); |
470 switch (status) { | 470 switch (status) { |
471 case DRAG_COMPLETE: | 471 case DRAG_COMPLETE: |
472 resizer->resizer()->CompleteDrag(); | 472 resizer->resizer()->CompleteDrag(); |
473 break; | 473 break; |
474 case DRAG_REVERT: | 474 case DRAG_REVERT: |
475 resizer->resizer()->RevertDrag(); | 475 resizer->resizer()->RevertDrag(); |
476 break; | 476 break; |
477 case DRAG_RESIZER_WINDOW_DESTROYED: | 477 case DRAG_RESIZER_WINDOW_DESTROYED: |
478 // We explicitly do not invoke RevertDrag() since that may do things to | 478 // We explicitly do not invoke RevertDrag() since that may do things to |
479 // WindowResizer::GetTarget() which was destroyed. | 479 // WindowResizer::GetTarget() which was destroyed. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 default: | 628 default: |
629 NOTREACHED(); | 629 NOTREACHED(); |
630 } | 630 } |
631 } | 631 } |
632 | 632 |
633 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { | 633 void ToplevelWindowEventHandler::ResizerWindowDestroyed() { |
634 CompleteDrag(DRAG_RESIZER_WINDOW_DESTROYED); | 634 CompleteDrag(DRAG_RESIZER_WINDOW_DESTROYED); |
635 } | 635 } |
636 | 636 |
637 } // namespace ash | 637 } // namespace ash |
OLD | NEW |