| 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/aura/root_window.h" | 5 #include "ui/aura/root_window.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 point->Offset(location.x(), location.y()); | 386 point->Offset(location.x(), location.y()); |
| 387 } | 387 } |
| 388 | 388 |
| 389 void RootWindow::ConvertPointFromNativeScreen(gfx::Point* point) const { | 389 void RootWindow::ConvertPointFromNativeScreen(gfx::Point* point) const { |
| 390 gfx::Point location = host_->GetLocationOnNativeScreen(); | 390 gfx::Point location = host_->GetLocationOnNativeScreen(); |
| 391 point->Offset(-location.x(), -location.y()); | 391 point->Offset(-location.x(), -location.y()); |
| 392 *point = gfx::ToFlooredPoint( | 392 *point = gfx::ToFlooredPoint( |
| 393 point->Scale(1 / ui::GetDeviceScaleFactor(layer()))); | 393 point->Scale(1 / ui::GetDeviceScaleFactor(layer()))); |
| 394 } | 394 } |
| 395 | 395 |
| 396 void RootWindow::AdvanceQueuedTouchEvent(Window* window, bool processed) { | 396 void RootWindow::ProcessedTouchEvent(ui::TouchEvent* event, |
| 397 Window* window, |
| 398 ui::EventResult result) { |
| 397 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; | 399 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
| 398 gestures.reset(gesture_recognizer_->AdvanceTouchQueue(window, processed)); | 400 gestures.reset(gesture_recognizer_->ProcessTouchEventForGesture( |
| 401 *event, result, window)); |
| 399 ProcessGestures(gestures.get()); | 402 ProcessGestures(gestures.get()); |
| 400 } | 403 } |
| 401 | 404 |
| 402 void RootWindow::SetGestureRecognizerForTesting(ui::GestureRecognizer* gr) { | 405 void RootWindow::SetGestureRecognizerForTesting(ui::GestureRecognizer* gr) { |
| 403 gesture_recognizer_.reset(gr); | 406 gesture_recognizer_.reset(gr); |
| 404 } | 407 } |
| 405 | 408 |
| 406 gfx::AcceleratedWidget RootWindow::GetAcceleratedWidget() { | 409 gfx::AcceleratedWidget RootWindow::GetAcceleratedWidget() { |
| 407 return host_->GetAcceleratedWidget(); | 410 return host_->GetAcceleratedWidget(); |
| 408 } | 411 } |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 mouse_moved_handler_ = NULL; | 752 mouse_moved_handler_ = NULL; |
| 750 if (invisible->Contains(mouse_event_dispatch_target_)) | 753 if (invisible->Contains(mouse_event_dispatch_target_)) |
| 751 mouse_event_dispatch_target_ = NULL; | 754 mouse_event_dispatch_target_ = NULL; |
| 752 if (invisible->Contains(event_dispatch_target_)) | 755 if (invisible->Contains(event_dispatch_target_)) |
| 753 event_dispatch_target_ = NULL; | 756 event_dispatch_target_ = NULL; |
| 754 | 757 |
| 755 CleanupGestureRecognizerState(invisible); | 758 CleanupGestureRecognizerState(invisible); |
| 756 } | 759 } |
| 757 | 760 |
| 758 void RootWindow::CleanupGestureRecognizerState(Window* window) { | 761 void RootWindow::CleanupGestureRecognizerState(Window* window) { |
| 759 gesture_recognizer_->FlushTouchQueue(window); | 762 gesture_recognizer_->CleanupStateForConsumer(window); |
| 760 Windows windows = window->children(); | 763 Windows windows = window->children(); |
| 761 for (Windows::const_iterator iter = windows.begin(); | 764 for (Windows::const_iterator iter = windows.begin(); |
| 762 iter != windows.end(); | 765 iter != windows.end(); |
| 763 ++iter) { | 766 ++iter) { |
| 764 CleanupGestureRecognizerState(*iter); | 767 CleanupGestureRecognizerState(*iter); |
| 765 } | 768 } |
| 766 } | 769 } |
| 767 | 770 |
| 768 void RootWindow::OnWindowAddedToRootWindow(Window* attached) { | 771 void RootWindow::OnWindowAddedToRootWindow(Window* attached) { |
| 769 if (attached->IsVisible() && | 772 if (attached->IsVisible() && |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 if (!target) { | 907 if (!target) { |
| 905 target = GetEventHandlerForPoint(event->location()); | 908 target = GetEventHandlerForPoint(event->location()); |
| 906 if (!target) | 909 if (!target) |
| 907 return false; | 910 return false; |
| 908 } | 911 } |
| 909 | 912 |
| 910 ui::TouchEvent translated_event( | 913 ui::TouchEvent translated_event( |
| 911 *event, static_cast<Window*>(this), target); | 914 *event, static_cast<Window*>(this), target); |
| 912 result = ProcessTouchEvent(target, &translated_event); | 915 result = ProcessTouchEvent(target, &translated_event); |
| 913 handled = result != ui::ER_UNHANDLED; | 916 handled = result != ui::ER_UNHANDLED; |
| 914 | |
| 915 if (result & ui::ER_ASYNC) { | |
| 916 gesture_recognizer_->QueueTouchEventForGesture(target, *event); | |
| 917 return true; | |
| 918 } | |
| 919 } | 917 } |
| 920 | 918 |
| 921 // Get the list of GestureEvents from GestureRecognizer. | 919 // Get the list of GestureEvents from GestureRecognizer. |
| 922 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; | 920 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; |
| 923 gestures.reset(gesture_recognizer_->ProcessTouchEventForGesture( | 921 gestures.reset(gesture_recognizer_->ProcessTouchEventForGesture( |
| 924 *event, result, target)); | 922 *event, result, target)); |
| 925 | 923 |
| 926 return ProcessGestures(gestures.get()) ? true : handled; | 924 return ProcessGestures(gestures.get()) ? true : handled; |
| 927 } | 925 } |
| 928 | 926 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 void RootWindow::UnlockCompositor() { | 1065 void RootWindow::UnlockCompositor() { |
| 1068 DCHECK(compositor_lock_); | 1066 DCHECK(compositor_lock_); |
| 1069 compositor_lock_ = NULL; | 1067 compositor_lock_ = NULL; |
| 1070 if (draw_on_compositor_unlock_) { | 1068 if (draw_on_compositor_unlock_) { |
| 1071 draw_on_compositor_unlock_ = false; | 1069 draw_on_compositor_unlock_ = false; |
| 1072 ScheduleDraw(); | 1070 ScheduleDraw(); |
| 1073 } | 1071 } |
| 1074 } | 1072 } |
| 1075 | 1073 |
| 1076 } // namespace aura | 1074 } // namespace aura |
| OLD | NEW |