| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 client::GetScreenPositionClient(root_window); | 63 client::GetScreenPositionClient(root_window); |
| 64 if (client) { | 64 if (client) { |
| 65 gfx::Point location_in_screen = location_in_root; | 65 gfx::Point location_in_screen = location_in_root; |
| 66 client->ConvertPointToScreen(root_window, &location_in_screen); | 66 client->ConvertPointToScreen(root_window, &location_in_screen); |
| 67 Env::GetInstance()->set_last_mouse_location(location_in_screen); | 67 Env::GetInstance()->set_last_mouse_location(location_in_screen); |
| 68 } else { | 68 } else { |
| 69 Env::GetInstance()->set_last_mouse_location(location_in_root); | 69 Env::GetInstance()->set_last_mouse_location(location_in_root); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 RootWindowHost* CreateHost(RootWindow* root_window, | 73 WindowTreeHost* CreateHost(RootWindow* root_window, |
| 74 const RootWindow::CreateParams& params) { | 74 const RootWindow::CreateParams& params) { |
| 75 RootWindowHost* host = params.host ? | 75 WindowTreeHost* host = params.host ? |
| 76 params.host : RootWindowHost::Create(params.initial_bounds); | 76 params.host : WindowTreeHost::Create(params.initial_bounds); |
| 77 host->set_delegate(root_window); | 77 host->set_delegate(root_window); |
| 78 return host; | 78 return host; |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool IsUsingEventProcessorForDispatch(const ui::Event& event) { | 81 bool IsUsingEventProcessorForDispatch(const ui::Event& event) { |
| 82 return event.IsKeyEvent() || | 82 return event.IsKeyEvent() || |
| 83 event.IsScrollEvent(); | 83 event.IsScrollEvent(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace | 86 } // namespace |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 base::Bind(base::IgnoreResult(&RootWindow::DispatchHeldEvents), | 172 base::Bind(base::IgnoreResult(&RootWindow::DispatchHeldEvents), |
| 173 repost_event_factory_.GetWeakPtr())); | 173 repost_event_factory_.GetWeakPtr())); |
| 174 } else { | 174 } else { |
| 175 DCHECK(event.type() == ui::ET_GESTURE_TAP_DOWN); | 175 DCHECK(event.type() == ui::ET_GESTURE_TAP_DOWN); |
| 176 held_repostable_event_.reset(); | 176 held_repostable_event_.reset(); |
| 177 // TODO(rbyers): Reposing of gestures is tricky to get | 177 // TODO(rbyers): Reposing of gestures is tricky to get |
| 178 // right, so it's not yet supported. crbug.com/170987. | 178 // right, so it's not yet supported. crbug.com/170987. |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 RootWindowHostDelegate* RootWindow::AsRootWindowHostDelegate() { | 182 WindowTreeHostDelegate* RootWindow::AsWindowTreeHostDelegate() { |
| 183 return this; | 183 return this; |
| 184 } | 184 } |
| 185 | 185 |
| 186 void RootWindow::SetHostSize(const gfx::Size& size_in_pixel) { | 186 void RootWindow::SetHostSize(const gfx::Size& size_in_pixel) { |
| 187 DispatchDetails details = DispatchHeldEvents(); | 187 DispatchDetails details = DispatchHeldEvents(); |
| 188 if (details.dispatcher_destroyed) | 188 if (details.dispatcher_destroyed) |
| 189 return; | 189 return; |
| 190 gfx::Rect bounds = host_->GetBounds(); | 190 gfx::Rect bounds = host_->GetBounds(); |
| 191 bounds.set_size(size_in_pixel); | 191 bounds.set_size(size_in_pixel); |
| 192 host_->SetBounds(bounds); | 192 host_->SetBounds(bounds); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 window->ContainsPointInRoot(GetLastMouseLocationInRoot()))) { | 330 window->ContainsPointInRoot(GetLastMouseLocationInRoot()))) { |
| 331 PostMouseMoveEventAfterWindowChange(); | 331 PostMouseMoveEventAfterWindowChange(); |
| 332 } | 332 } |
| 333 } | 333 } |
| 334 | 334 |
| 335 void RootWindow::OnKeyboardMappingChanged() { | 335 void RootWindow::OnKeyboardMappingChanged() { |
| 336 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 336 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
| 337 OnKeyboardMappingChanged(this)); | 337 OnKeyboardMappingChanged(this)); |
| 338 } | 338 } |
| 339 | 339 |
| 340 void RootWindow::OnRootWindowHostCloseRequested() { | 340 void RootWindow::OnWindowTreeHostCloseRequested() { |
| 341 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 341 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
| 342 OnRootWindowHostCloseRequested(this)); | 342 OnWindowTreeHostCloseRequested(this)); |
| 343 } | 343 } |
| 344 | 344 |
| 345 void RootWindow::AddRootWindowObserver(RootWindowObserver* observer) { | 345 void RootWindow::AddRootWindowObserver(RootWindowObserver* observer) { |
| 346 observers_.AddObserver(observer); | 346 observers_.AddObserver(observer); |
| 347 } | 347 } |
| 348 | 348 |
| 349 void RootWindow::RemoveRootWindowObserver(RootWindowObserver* observer) { | 349 void RootWindow::RemoveRootWindowObserver(RootWindowObserver* observer) { |
| 350 observers_.RemoveObserver(observer); | 350 observers_.RemoveObserver(observer); |
| 351 } | 351 } |
| 352 | 352 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 | 635 |
| 636 void RootWindow::OnLayerAnimationScheduled( | 636 void RootWindow::OnLayerAnimationScheduled( |
| 637 ui::LayerAnimationSequence* animation) { | 637 ui::LayerAnimationSequence* animation) { |
| 638 } | 638 } |
| 639 | 639 |
| 640 void RootWindow::OnLayerAnimationAborted( | 640 void RootWindow::OnLayerAnimationAborted( |
| 641 ui::LayerAnimationSequence* animation) { | 641 ui::LayerAnimationSequence* animation) { |
| 642 } | 642 } |
| 643 | 643 |
| 644 //////////////////////////////////////////////////////////////////////////////// | 644 //////////////////////////////////////////////////////////////////////////////// |
| 645 // RootWindow, RootWindowHostDelegate implementation: | 645 // RootWindow, WindowTreeHostDelegate implementation: |
| 646 | 646 |
| 647 bool RootWindow::OnHostKeyEvent(ui::KeyEvent* event) { | 647 bool RootWindow::OnHostKeyEvent(ui::KeyEvent* event) { |
| 648 DispatchDetails details = OnEventFromSource(event); | 648 DispatchDetails details = OnEventFromSource(event); |
| 649 if (details.dispatcher_destroyed) | 649 if (details.dispatcher_destroyed) |
| 650 event->SetHandled(); | 650 event->SetHandled(); |
| 651 return event->handled(); | 651 return event->handled(); |
| 652 } | 652 } |
| 653 | 653 |
| 654 bool RootWindow::OnHostMouseEvent(ui::MouseEvent* event) { | 654 bool RootWindow::OnHostMouseEvent(ui::MouseEvent* event) { |
| 655 DispatchDetails details = OnHostMouseEventImpl(event); | 655 DispatchDetails details = OnHostMouseEventImpl(event); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 void RootWindow::OnHostLostMouseGrab() { | 708 void RootWindow::OnHostLostMouseGrab() { |
| 709 mouse_pressed_handler_ = NULL; | 709 mouse_pressed_handler_ = NULL; |
| 710 mouse_moved_handler_ = NULL; | 710 mouse_moved_handler_ = NULL; |
| 711 } | 711 } |
| 712 | 712 |
| 713 void RootWindow::OnHostMoved(const gfx::Point& origin) { | 713 void RootWindow::OnHostMoved(const gfx::Point& origin) { |
| 714 TRACE_EVENT1("ui", "RootWindow::OnHostMoved", | 714 TRACE_EVENT1("ui", "RootWindow::OnHostMoved", |
| 715 "origin", origin.ToString()); | 715 "origin", origin.ToString()); |
| 716 | 716 |
| 717 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 717 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
| 718 OnRootWindowHostMoved(this, origin)); | 718 OnWindowTreeHostMoved(this, origin)); |
| 719 } | 719 } |
| 720 | 720 |
| 721 void RootWindow::OnHostResized(const gfx::Size& size) { | 721 void RootWindow::OnHostResized(const gfx::Size& size) { |
| 722 TRACE_EVENT1("ui", "RootWindow::OnHostResized", | 722 TRACE_EVENT1("ui", "RootWindow::OnHostResized", |
| 723 "size", size.ToString()); | 723 "size", size.ToString()); |
| 724 | 724 |
| 725 DispatchDetails details = DispatchHeldEvents(); | 725 DispatchDetails details = DispatchHeldEvents(); |
| 726 if (details.dispatcher_destroyed) | 726 if (details.dispatcher_destroyed) |
| 727 return; | 727 return; |
| 728 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 728 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
| 729 OnRootWindowHostResized(this)); | 729 OnWindowTreeHostResized(this)); |
| 730 } | 730 } |
| 731 | 731 |
| 732 RootWindow* RootWindow::AsRootWindow() { | 732 RootWindow* RootWindow::AsRootWindow() { |
| 733 return this; | 733 return this; |
| 734 } | 734 } |
| 735 | 735 |
| 736 const RootWindow* RootWindow::AsRootWindow() const { | 736 const RootWindow* RootWindow::AsRootWindow() const { |
| 737 return this; | 737 return this; |
| 738 } | 738 } |
| 739 | 739 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 flags |= ui::EF_IS_NON_CLIENT; | 1030 flags |= ui::EF_IS_NON_CLIENT; |
| 1031 event->set_flags(flags); | 1031 event->set_flags(flags); |
| 1032 | 1032 |
| 1033 if (!dispatching_held_event_) { | 1033 if (!dispatching_held_event_) { |
| 1034 SetLastMouseLocation(window(), event->location()); | 1034 SetLastMouseLocation(window(), event->location()); |
| 1035 synthesize_mouse_move_ = false; | 1035 synthesize_mouse_move_ = false; |
| 1036 } | 1036 } |
| 1037 } | 1037 } |
| 1038 | 1038 |
| 1039 } // namespace aura | 1039 } // namespace aura |
| OLD | NEW |