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 event.IsTouchEvent(); | 84 event.IsTouchEvent(); |
85 } | 85 } |
86 | 86 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 base::Bind(base::IgnoreResult(&RootWindow::DispatchHeldEvents), | 183 base::Bind(base::IgnoreResult(&RootWindow::DispatchHeldEvents), |
184 repost_event_factory_.GetWeakPtr())); | 184 repost_event_factory_.GetWeakPtr())); |
185 } else { | 185 } else { |
186 DCHECK(event.type() == ui::ET_GESTURE_TAP_DOWN); | 186 DCHECK(event.type() == ui::ET_GESTURE_TAP_DOWN); |
187 held_repostable_event_.reset(); | 187 held_repostable_event_.reset(); |
188 // TODO(rbyers): Reposing of gestures is tricky to get | 188 // TODO(rbyers): Reposing of gestures is tricky to get |
189 // right, so it's not yet supported. crbug.com/170987. | 189 // right, so it's not yet supported. crbug.com/170987. |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 RootWindowHostDelegate* RootWindow::AsRootWindowHostDelegate() { | 193 WindowTreeHostDelegate* RootWindow::AsWindowTreeHostDelegate() { |
194 return this; | 194 return this; |
195 } | 195 } |
196 | 196 |
197 void RootWindow::SetHostSize(const gfx::Size& size_in_pixel) { | 197 void RootWindow::SetHostSize(const gfx::Size& size_in_pixel) { |
198 DispatchDetails details = DispatchHeldEvents(); | 198 DispatchDetails details = DispatchHeldEvents(); |
199 if (details.dispatcher_destroyed) | 199 if (details.dispatcher_destroyed) |
200 return; | 200 return; |
201 gfx::Rect bounds = host_->GetBounds(); | 201 gfx::Rect bounds = host_->GetBounds(); |
202 bounds.set_size(size_in_pixel); | 202 bounds.set_size(size_in_pixel); |
203 host_->SetBounds(bounds); | 203 host_->SetBounds(bounds); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 window->ContainsPointInRoot(GetLastMouseLocationInRoot()))) { | 341 window->ContainsPointInRoot(GetLastMouseLocationInRoot()))) { |
342 PostMouseMoveEventAfterWindowChange(); | 342 PostMouseMoveEventAfterWindowChange(); |
343 } | 343 } |
344 } | 344 } |
345 | 345 |
346 void RootWindow::OnKeyboardMappingChanged() { | 346 void RootWindow::OnKeyboardMappingChanged() { |
347 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 347 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
348 OnKeyboardMappingChanged(this)); | 348 OnKeyboardMappingChanged(this)); |
349 } | 349 } |
350 | 350 |
351 void RootWindow::OnRootWindowHostCloseRequested() { | 351 void RootWindow::OnWindowTreeHostCloseRequested() { |
352 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 352 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
353 OnRootWindowHostCloseRequested(this)); | 353 OnWindowTreeHostCloseRequested(this)); |
354 } | 354 } |
355 | 355 |
356 void RootWindow::AddRootWindowObserver(RootWindowObserver* observer) { | 356 void RootWindow::AddRootWindowObserver(RootWindowObserver* observer) { |
357 observers_.AddObserver(observer); | 357 observers_.AddObserver(observer); |
358 } | 358 } |
359 | 359 |
360 void RootWindow::RemoveRootWindowObserver(RootWindowObserver* observer) { | 360 void RootWindow::RemoveRootWindowObserver(RootWindowObserver* observer) { |
361 observers_.RemoveObserver(observer); | 361 observers_.RemoveObserver(observer); |
362 } | 362 } |
363 | 363 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 | 664 |
665 void RootWindow::OnLayerAnimationScheduled( | 665 void RootWindow::OnLayerAnimationScheduled( |
666 ui::LayerAnimationSequence* animation) { | 666 ui::LayerAnimationSequence* animation) { |
667 } | 667 } |
668 | 668 |
669 void RootWindow::OnLayerAnimationAborted( | 669 void RootWindow::OnLayerAnimationAborted( |
670 ui::LayerAnimationSequence* animation) { | 670 ui::LayerAnimationSequence* animation) { |
671 } | 671 } |
672 | 672 |
673 //////////////////////////////////////////////////////////////////////////////// | 673 //////////////////////////////////////////////////////////////////////////////// |
674 // RootWindow, RootWindowHostDelegate implementation: | 674 // RootWindow, WindowTreeHostDelegate implementation: |
675 | 675 |
676 bool RootWindow::OnHostKeyEvent(ui::KeyEvent* event) { | 676 bool RootWindow::OnHostKeyEvent(ui::KeyEvent* event) { |
677 DispatchDetails details = OnEventFromSource(event); | 677 DispatchDetails details = OnEventFromSource(event); |
678 if (details.dispatcher_destroyed) | 678 if (details.dispatcher_destroyed) |
679 event->SetHandled(); | 679 event->SetHandled(); |
680 return event->handled(); | 680 return event->handled(); |
681 } | 681 } |
682 | 682 |
683 bool RootWindow::OnHostMouseEvent(ui::MouseEvent* event) { | 683 bool RootWindow::OnHostMouseEvent(ui::MouseEvent* event) { |
684 DispatchDetails details = OnHostMouseEventImpl(event); | 684 DispatchDetails details = OnHostMouseEventImpl(event); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 void RootWindow::OnHostLostMouseGrab() { | 721 void RootWindow::OnHostLostMouseGrab() { |
722 mouse_pressed_handler_ = NULL; | 722 mouse_pressed_handler_ = NULL; |
723 mouse_moved_handler_ = NULL; | 723 mouse_moved_handler_ = NULL; |
724 } | 724 } |
725 | 725 |
726 void RootWindow::OnHostMoved(const gfx::Point& origin) { | 726 void RootWindow::OnHostMoved(const gfx::Point& origin) { |
727 TRACE_EVENT1("ui", "RootWindow::OnHostMoved", | 727 TRACE_EVENT1("ui", "RootWindow::OnHostMoved", |
728 "origin", origin.ToString()); | 728 "origin", origin.ToString()); |
729 | 729 |
730 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 730 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
731 OnRootWindowHostMoved(this, origin)); | 731 OnWindowTreeHostMoved(this, origin)); |
732 } | 732 } |
733 | 733 |
734 void RootWindow::OnHostResized(const gfx::Size& size) { | 734 void RootWindow::OnHostResized(const gfx::Size& size) { |
735 TRACE_EVENT1("ui", "RootWindow::OnHostResized", | 735 TRACE_EVENT1("ui", "RootWindow::OnHostResized", |
736 "size", size.ToString()); | 736 "size", size.ToString()); |
737 | 737 |
738 DispatchDetails details = DispatchHeldEvents(); | 738 DispatchDetails details = DispatchHeldEvents(); |
739 if (details.dispatcher_destroyed) | 739 if (details.dispatcher_destroyed) |
740 return; | 740 return; |
741 FOR_EACH_OBSERVER(RootWindowObserver, observers_, | 741 FOR_EACH_OBSERVER(RootWindowObserver, observers_, |
742 OnRootWindowHostResized(this)); | 742 OnWindowTreeHostResized(this)); |
743 } | 743 } |
744 | 744 |
745 RootWindow* RootWindow::AsRootWindow() { | 745 RootWindow* RootWindow::AsRootWindow() { |
746 return this; | 746 return this; |
747 } | 747 } |
748 | 748 |
749 const RootWindow* RootWindow::AsRootWindow() const { | 749 const RootWindow* RootWindow::AsRootWindow() const { |
750 return this; | 750 return this; |
751 } | 751 } |
752 | 752 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 break; | 1007 break; |
1008 | 1008 |
1009 default: | 1009 default: |
1010 NOTREACHED(); | 1010 NOTREACHED(); |
1011 break; | 1011 break; |
1012 } | 1012 } |
1013 PreDispatchLocatedEvent(target, event); | 1013 PreDispatchLocatedEvent(target, event); |
1014 } | 1014 } |
1015 | 1015 |
1016 } // namespace aura | 1016 } // namespace aura |
OLD | NEW |