| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 TRACE_EVENT_ASYNC_BEGIN0("ui", "RootWindow::Draw", | 240 TRACE_EVENT_ASYNC_BEGIN0("ui", "RootWindow::Draw", |
| 241 compositor_->last_started_frame() + 1); | 241 compositor_->last_started_frame() + 1); |
| 242 | 242 |
| 243 compositor_->Draw(false); | 243 compositor_->Draw(false); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void RootWindow::ScheduleFullDraw() { | 246 void RootWindow::ScheduleFullDraw() { |
| 247 compositor_->ScheduleFullDraw(); | 247 compositor_->ScheduleFullDraw(); |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool RootWindow::DispatchNativeEvent(const base::NativeEvent& native_event) { |
| 251 #if !defined(OS_MACOSX) |
| 252 return host_->DispatchNativeEvent(native_event); |
| 253 #endif |
| 254 return false; |
| 255 } |
| 256 |
| 250 bool RootWindow::DispatchMouseEvent(MouseEvent* event) { | 257 bool RootWindow::DispatchMouseEvent(MouseEvent* event) { |
| 251 if (event->type() == ui::ET_MOUSE_DRAGGED || | 258 if (event->type() == ui::ET_MOUSE_DRAGGED || |
| 252 (event->flags() & ui::EF_IS_SYNTHESIZED)) { | 259 (event->flags() & ui::EF_IS_SYNTHESIZED)) { |
| 253 if (mouse_move_hold_count_) { | 260 if (mouse_move_hold_count_) { |
| 254 held_mouse_move_.reset(new MouseEvent(*event, NULL, NULL)); | 261 held_mouse_move_.reset(new MouseEvent(*event, NULL, NULL)); |
| 255 return true; | 262 return true; |
| 256 } else { | 263 } else { |
| 257 // We may have a held event for a period between the time | 264 // We may have a held event for a period between the time |
| 258 // mouse_move_hold_count_ fell to 0 and the DispatchHeldMouseMove | 265 // mouse_move_hold_count_ fell to 0 and the DispatchHeldMouseMove |
| 259 // executes. Since we're going to dispatch the new event directly below, | 266 // executes. Since we're going to dispatch the new event directly below, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 window->ContainsPointInRoot(last_mouse_location_))) { | 442 window->ContainsPointInRoot(last_mouse_location_))) { |
| 436 PostMouseMoveEventAfterWindowChange(); | 443 PostMouseMoveEventAfterWindowChange(); |
| 437 } | 444 } |
| 438 } | 445 } |
| 439 | 446 |
| 440 void RootWindow::OnKeyboardMappingChanged() { | 447 void RootWindow::OnKeyboardMappingChanged() { |
| 441 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 448 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
| 442 OnKeyboardMappingChanged(this)); | 449 OnKeyboardMappingChanged(this)); |
| 443 } | 450 } |
| 444 | 451 |
| 452 void RootWindow::OnCursorChanged(ui::PlatformCursor cursor) { |
| 453 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
| 454 OnCursorChanged(this, cursor)); |
| 455 } |
| 456 |
| 445 void RootWindow::OnRootWindowHostClosed() { | 457 void RootWindow::OnRootWindowHostClosed() { |
| 446 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 458 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
| 447 OnRootWindowHostClosed(this)); | 459 OnRootWindowHostClosed(this)); |
| 448 } | 460 } |
| 449 | 461 |
| 450 void RootWindow::AddRootWindowObserver(RootWindowObserver* observer) { | 462 void RootWindow::AddRootWindowObserver(RootWindowObserver* observer) { |
| 451 observers_.AddObserver(observer); | 463 observers_.AddObserver(observer); |
| 452 } | 464 } |
| 453 | 465 |
| 454 void RootWindow::RemoveRootWindowObserver(RootWindowObserver* observer) { | 466 void RootWindow::RemoveRootWindowObserver(RootWindowObserver* observer) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 473 } | 485 } |
| 474 | 486 |
| 475 void RootWindow::SetGestureRecognizerForTesting(ui::GestureRecognizer* gr) { | 487 void RootWindow::SetGestureRecognizerForTesting(ui::GestureRecognizer* gr) { |
| 476 gesture_recognizer_.reset(gr); | 488 gesture_recognizer_.reset(gr); |
| 477 } | 489 } |
| 478 | 490 |
| 479 gfx::AcceleratedWidget RootWindow::GetAcceleratedWidget() { | 491 gfx::AcceleratedWidget RootWindow::GetAcceleratedWidget() { |
| 480 return host_->GetAcceleratedWidget(); | 492 return host_->GetAcceleratedWidget(); |
| 481 } | 493 } |
| 482 | 494 |
| 495 gfx::AcceleratedWidget RootWindow::GetAcceleratedWidgetUsedForEvents() { |
| 496 return host_->GetAcceleratedWidgetUsedForEvents(); |
| 497 } |
| 498 |
| 483 void RootWindow::ToggleFullScreen() { | 499 void RootWindow::ToggleFullScreen() { |
| 484 host_->ToggleFullScreen(); | 500 host_->ToggleFullScreen(); |
| 485 } | 501 } |
| 486 | 502 |
| 487 void RootWindow::HoldMouseMoves() { | 503 void RootWindow::HoldMouseMoves() { |
| 488 if (!mouse_move_hold_count_) | 504 if (!mouse_move_hold_count_) |
| 489 held_mouse_event_factory_.InvalidateWeakPtrs(); | 505 held_mouse_event_factory_.InvalidateWeakPtrs(); |
| 490 ++mouse_move_hold_count_; | 506 ++mouse_move_hold_count_; |
| 491 } | 507 } |
| 492 | 508 |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 void RootWindow::UnlockCompositor() { | 999 void RootWindow::UnlockCompositor() { |
| 984 DCHECK(compositor_lock_); | 1000 DCHECK(compositor_lock_); |
| 985 compositor_lock_ = NULL; | 1001 compositor_lock_ = NULL; |
| 986 if (draw_on_compositor_unlock_) { | 1002 if (draw_on_compositor_unlock_) { |
| 987 draw_on_compositor_unlock_ = false; | 1003 draw_on_compositor_unlock_ = false; |
| 988 ScheduleDraw(); | 1004 ScheduleDraw(); |
| 989 } | 1005 } |
| 990 } | 1006 } |
| 991 | 1007 |
| 992 } // namespace aura | 1008 } // namespace aura |
| OLD | NEW |