| 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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 } | 423 } |
| 424 | 424 |
| 425 gfx::Point RootWindow::GetLastMouseLocationInRoot() const { | 425 gfx::Point RootWindow::GetLastMouseLocationInRoot() const { |
| 426 gfx::Point location = Env::GetInstance()->last_mouse_location(); | 426 gfx::Point location = Env::GetInstance()->last_mouse_location(); |
| 427 client::ScreenPositionClient* client = client::GetScreenPositionClient(this); | 427 client::ScreenPositionClient* client = client::GetScreenPositionClient(this); |
| 428 if (client) | 428 if (client) |
| 429 client->ConvertPointFromScreen(this, &location); | 429 client->ConvertPointFromScreen(this, &location); |
| 430 return location; | 430 return location; |
| 431 } | 431 } |
| 432 | 432 |
| 433 void RootWindow::DelayDrawsForTesting(base::TimeDelta delay) { |
| 434 draw_scheduling_delay_for_testing_ = delay; |
| 435 } |
| 436 |
| 433 //////////////////////////////////////////////////////////////////////////////// | 437 //////////////////////////////////////////////////////////////////////////////// |
| 434 // RootWindow, Window overrides: | 438 // RootWindow, Window overrides: |
| 435 | 439 |
| 436 RootWindow* RootWindow::GetRootWindow() { | 440 RootWindow* RootWindow::GetRootWindow() { |
| 437 return this; | 441 return this; |
| 438 } | 442 } |
| 439 | 443 |
| 440 const RootWindow* RootWindow::GetRootWindow() const { | 444 const RootWindow* RootWindow::GetRootWindow() const { |
| 441 return this; | 445 return this; |
| 442 } | 446 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 456 ui::EventTarget* RootWindow::GetParentTarget() { | 460 ui::EventTarget* RootWindow::GetParentTarget() { |
| 457 return client::GetEventClient(this) ? | 461 return client::GetEventClient(this) ? |
| 458 client::GetEventClient(this)->GetToplevelEventTarget() : | 462 client::GetEventClient(this)->GetToplevelEventTarget() : |
| 459 Env::GetInstance(); | 463 Env::GetInstance(); |
| 460 } | 464 } |
| 461 | 465 |
| 462 //////////////////////////////////////////////////////////////////////////////// | 466 //////////////////////////////////////////////////////////////////////////////// |
| 463 // RootWindow, ui::CompositorDelegate implementation: | 467 // RootWindow, ui::CompositorDelegate implementation: |
| 464 | 468 |
| 465 void RootWindow::ScheduleDraw() { | 469 void RootWindow::ScheduleDraw() { |
| 466 if (!defer_draw_scheduling_) { | 470 if (defer_draw_scheduling_) |
| 467 defer_draw_scheduling_ = true; | 471 return; |
| 472 |
| 473 defer_draw_scheduling_ = true; |
| 474 if (draw_scheduling_delay_for_testing_ == base::TimeDelta()) { |
| 468 MessageLoop::current()->PostTask( | 475 MessageLoop::current()->PostTask( |
| 469 FROM_HERE, | 476 FROM_HERE, |
| 470 base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr())); | 477 base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr())); |
| 478 } else { |
| 479 MessageLoop::current()->PostDelayedTask( |
| 480 FROM_HERE, |
| 481 base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr()), |
| 482 draw_scheduling_delay_for_testing_); |
| 471 } | 483 } |
| 472 } | 484 } |
| 473 | 485 |
| 474 //////////////////////////////////////////////////////////////////////////////// | 486 //////////////////////////////////////////////////////////////////////////////// |
| 475 // RootWindow, ui::CompositorObserver implementation: | 487 // RootWindow, ui::CompositorObserver implementation: |
| 476 | 488 |
| 477 void RootWindow::OnCompositingDidCommit(ui::Compositor*) { | 489 void RootWindow::OnCompositingDidCommit(ui::Compositor*) { |
| 478 } | 490 } |
| 479 | 491 |
| 480 void RootWindow::OnCompositingStarted(ui::Compositor*, | 492 void RootWindow::OnCompositingStarted(ui::Compositor*, |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1038 // currently broken. See/ crbug.com/107931. | 1050 // currently broken. See/ crbug.com/107931. |
| 1039 ui::MouseEvent event(ui::ET_MOUSE_MOVED, | 1051 ui::MouseEvent event(ui::ET_MOUSE_MOVED, |
| 1040 orig_mouse_location, | 1052 orig_mouse_location, |
| 1041 orig_mouse_location, | 1053 orig_mouse_location, |
| 1042 ui::EF_IS_SYNTHESIZED); | 1054 ui::EF_IS_SYNTHESIZED); |
| 1043 event.set_system_location(Env::GetInstance()->last_mouse_location()); | 1055 event.set_system_location(Env::GetInstance()->last_mouse_location()); |
| 1044 OnHostMouseEvent(&event); | 1056 OnHostMouseEvent(&event); |
| 1045 } | 1057 } |
| 1046 | 1058 |
| 1047 } // namespace aura | 1059 } // namespace aura |
| OLD | NEW |