| 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/gestures/shelf_gesture_handler.h" | 5 #include "ash/wm/gestures/shelf_gesture_handler.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shelf/shelf_types.h" | 9 #include "ash/shelf/shelf_types.h" |
| 10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { | 48 if (event.type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
| 49 drag_in_progress_ = true; | 49 drag_in_progress_ = true; |
| 50 shelf->StartGestureDrag(event); | 50 shelf->StartGestureDrag(event); |
| 51 return true; | 51 return true; |
| 52 } | 52 } |
| 53 | 53 |
| 54 if (!drag_in_progress_) | 54 if (!drag_in_progress_) |
| 55 return false; | 55 return false; |
| 56 | 56 |
| 57 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) { | 57 if (event.type() == ui::ET_GESTURE_SCROLL_UPDATE) { |
| 58 if (tray_handler_.get()) { | 58 if (tray_handler_) { |
| 59 if (!tray_handler_->UpdateGestureDrag(event)) | 59 if (!tray_handler_->UpdateGestureDrag(event)) |
| 60 tray_handler_.reset(); | 60 tray_handler_.reset(); |
| 61 } else if (shelf->UpdateGestureDrag(event) == | 61 } else if (shelf->UpdateGestureDrag(event) == |
| 62 ShelfLayoutManager::DRAG_TRAY) { | 62 ShelfLayoutManager::DRAG_TRAY) { |
| 63 tray_handler_.reset(new TrayGestureHandler()); | 63 tray_handler_.reset(new TrayGestureHandler()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 | 68 |
| 69 drag_in_progress_ = false; | 69 drag_in_progress_ = false; |
| 70 | 70 |
| 71 if (event.type() == ui::ET_GESTURE_SCROLL_END || | 71 if (event.type() == ui::ET_GESTURE_SCROLL_END || |
| 72 event.type() == ui::ET_SCROLL_FLING_START) { | 72 event.type() == ui::ET_SCROLL_FLING_START) { |
| 73 if (tray_handler_.get()) { | 73 if (tray_handler_) { |
| 74 tray_handler_->CompleteGestureDrag(event); | 74 tray_handler_->CompleteGestureDrag(event); |
| 75 tray_handler_.reset(); | 75 tray_handler_.reset(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 shelf->CompleteGestureDrag(event); | 78 shelf->CompleteGestureDrag(event); |
| 79 return true; | 79 return true; |
| 80 } | 80 } |
| 81 | 81 |
| 82 // Unexpected event. Reset the state and let the event fall through. | 82 // Unexpected event. Reset the state and let the event fall through. |
| 83 shelf->CancelGestureDrag(); | 83 shelf->CancelGestureDrag(); |
| 84 return false; | 84 return false; |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace internal | 87 } // namespace internal |
| 88 } // namespace ash | 88 } // namespace ash |
| OLD | NEW |