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 "ui/views/widget/root_view.h" | 5 #include "ui/views/widget/root_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 return ui::GESTURE_STATUS_UNKNOWN; | 407 return ui::GESTURE_STATUS_UNKNOWN; |
408 } | 408 } |
409 | 409 |
410 // See if this view wants to handle the Gesture. | 410 // See if this view wants to handle the Gesture. |
411 GestureEvent gesture_event(e, this, gesture_handling_view_); | 411 GestureEvent gesture_event(e, this, gesture_handling_view_); |
412 status = gesture_handling_view_->ProcessGestureEvent(gesture_event); | 412 status = gesture_handling_view_->ProcessGestureEvent(gesture_event); |
413 | 413 |
414 // The view could have removed itself from the tree when handling | 414 // The view could have removed itself from the tree when handling |
415 // OnGestureEvent(). So handle as per OnMousePressed. NB: we | 415 // OnGestureEvent(). So handle as per OnMousePressed. NB: we |
416 // assume that the RootView itself cannot be so removed. | 416 // assume that the RootView itself cannot be so removed. |
417 if (!gesture_handling_view_) return ui::GESTURE_STATUS_UNKNOWN; | 417 if (!gesture_handling_view_) |
| 418 return ui::GESTURE_STATUS_UNKNOWN; |
418 | 419 |
419 // The gesture event wasn't processed. Go up the view hierarchy and | 420 // The gesture event wasn't processed. Go up the view hierarchy and |
420 // dispatch the gesture event. | 421 // dispatch the gesture event. |
421 if (status == ui::GESTURE_STATUS_UNKNOWN) { | 422 if (status == ui::GESTURE_STATUS_UNKNOWN) |
422 continue; | 423 continue; |
423 } else if (status == ui::GESTURE_STATUS_CONSUMED) { | 424 else if (status == ui::GESTURE_STATUS_CONSUMED) |
424 return status; | 425 return status; |
425 } else { | 426 else |
426 return ui::GESTURE_STATUS_UNKNOWN; | 427 return ui::GESTURE_STATUS_UNKNOWN; |
427 } | |
428 } | 428 } |
429 return status; | 429 return status; |
430 } | 430 } |
431 | 431 |
432 void RootView::SetMouseHandler(View *new_mh) { | 432 void RootView::SetMouseHandler(View *new_mh) { |
433 // If we're clearing the mouse handler, clear explicit_mouse_handler_ as well. | 433 // If we're clearing the mouse handler, clear explicit_mouse_handler_ as well. |
434 explicit_mouse_handler_ = (new_mh != NULL); | 434 explicit_mouse_handler_ = (new_mh != NULL); |
435 mouse_pressed_handler_ = new_mh; | 435 mouse_pressed_handler_ = new_mh; |
436 drag_info_.Reset(); | 436 drag_info_.Reset(); |
437 } | 437 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 // TODO(Gajen): This should be removed in future once all views are capable | 523 // TODO(Gajen): This should be removed in future once all views are capable |
524 // of handling OnGestureEvent. | 524 // of handling OnGestureEvent. |
525 return gesture_manager_->ProcessTouchEventForGesture(event, this, | 525 return gesture_manager_->ProcessTouchEventForGesture(event, this, |
526 status); | 526 status); |
527 } | 527 } |
528 return synthetic; | 528 return synthetic; |
529 } | 529 } |
530 | 530 |
531 } // namespace internal | 531 } // namespace internal |
532 } // namespace views | 532 } // namespace views |
OLD | NEW |