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/window.h" | 5 #include "ui/aura/window.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "cc/output/compositor_frame_sink.h" |
21 #include "ui/aura/client/aura_constants.h" | 22 #include "ui/aura/client/aura_constants.h" |
22 #include "ui/aura/client/capture_client.h" | 23 #include "ui/aura/client/capture_client.h" |
23 #include "ui/aura/client/cursor_client.h" | 24 #include "ui/aura/client/cursor_client.h" |
24 #include "ui/aura/client/event_client.h" | 25 #include "ui/aura/client/event_client.h" |
25 #include "ui/aura/client/focus_client.h" | 26 #include "ui/aura/client/focus_client.h" |
26 #include "ui/aura/client/screen_position_client.h" | 27 #include "ui/aura/client/screen_position_client.h" |
27 #include "ui/aura/client/visibility_client.h" | 28 #include "ui/aura/client/visibility_client.h" |
28 #include "ui/aura/client/window_stacking_client.h" | 29 #include "ui/aura/client/window_stacking_client.h" |
29 #include "ui/aura/env.h" | 30 #include "ui/aura/env.h" |
30 #include "ui/aura/layout_manager.h" | 31 #include "ui/aura/layout_manager.h" |
| 32 #include "ui/aura/local/compositor_frame_sink_local.h" |
31 #include "ui/aura/window_delegate.h" | 33 #include "ui/aura/window_delegate.h" |
32 #include "ui/aura/window_event_dispatcher.h" | 34 #include "ui/aura/window_event_dispatcher.h" |
33 #include "ui/aura/window_observer.h" | 35 #include "ui/aura/window_observer.h" |
34 #include "ui/aura/window_port.h" | 36 #include "ui/aura/window_port.h" |
35 #include "ui/aura/window_port_local.h" | |
36 #include "ui/aura/window_tracker.h" | 37 #include "ui/aura/window_tracker.h" |
37 #include "ui/aura/window_tree_host.h" | 38 #include "ui/aura/window_tree_host.h" |
38 #include "ui/compositor/compositor.h" | 39 #include "ui/compositor/compositor.h" |
39 #include "ui/compositor/layer.h" | 40 #include "ui/compositor/layer.h" |
40 #include "ui/display/display.h" | 41 #include "ui/display/display.h" |
41 #include "ui/display/screen.h" | 42 #include "ui/display/screen.h" |
42 #include "ui/events/event_target_iterator.h" | 43 #include "ui/events/event_target_iterator.h" |
43 #include "ui/gfx/canvas.h" | 44 #include "ui/gfx/canvas.h" |
44 #include "ui/gfx/path.h" | 45 #include "ui/gfx/path.h" |
45 #include "ui/gfx/scoped_canvas.h" | 46 #include "ui/gfx/scoped_canvas.h" |
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 else | 844 else |
844 layer()->StackBelow(child->layer(), target->layer()); | 845 layer()->StackBelow(child->layer(), target->layer()); |
845 } | 846 } |
846 | 847 |
847 void Window::OnStackingChanged() { | 848 void Window::OnStackingChanged() { |
848 for (WindowObserver& observer : observers_) | 849 for (WindowObserver& observer : observers_) |
849 observer.OnWindowStackingChanged(this); | 850 observer.OnWindowStackingChanged(this); |
850 } | 851 } |
851 | 852 |
852 void Window::NotifyRemovingFromRootWindow(Window* new_root) { | 853 void Window::NotifyRemovingFromRootWindow(Window* new_root) { |
| 854 port_->OnWillRemoveWindowFromRootWindow(); |
853 for (WindowObserver& observer : observers_) | 855 for (WindowObserver& observer : observers_) |
854 observer.OnWindowRemovingFromRootWindow(this, new_root); | 856 observer.OnWindowRemovingFromRootWindow(this, new_root); |
855 for (Window::Windows::const_iterator it = children_.begin(); | 857 for (Window::Windows::const_iterator it = children_.begin(); |
856 it != children_.end(); ++it) { | 858 it != children_.end(); ++it) { |
857 (*it)->NotifyRemovingFromRootWindow(new_root); | 859 (*it)->NotifyRemovingFromRootWindow(new_root); |
858 } | 860 } |
859 } | 861 } |
860 | 862 |
861 void Window::NotifyAddedToRootWindow() { | 863 void Window::NotifyAddedToRootWindow() { |
| 864 port_->OnWindowAddedToRootWindow(); |
862 for (WindowObserver& observer : observers_) | 865 for (WindowObserver& observer : observers_) |
863 observer.OnWindowAddedToRootWindow(this); | 866 observer.OnWindowAddedToRootWindow(this); |
864 for (Window::Windows::const_iterator it = children_.begin(); | 867 for (Window::Windows::const_iterator it = children_.begin(); |
865 it != children_.end(); ++it) { | 868 it != children_.end(); ++it) { |
866 (*it)->NotifyAddedToRootWindow(); | 869 (*it)->NotifyAddedToRootWindow(); |
867 } | 870 } |
868 } | 871 } |
869 | 872 |
870 void Window::NotifyWindowHierarchyChange( | 873 void Window::NotifyWindowHierarchyChange( |
871 const WindowObserver::HierarchyChangeParams& params) { | 874 const WindowObserver::HierarchyChangeParams& params) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 state_modified |= | 984 state_modified |= |
982 ui::GestureRecognizer::Get()->CleanupStateForConsumer(this); | 985 ui::GestureRecognizer::Get()->CleanupStateForConsumer(this); |
983 for (Window::Windows::iterator iter = children_.begin(); | 986 for (Window::Windows::iterator iter = children_.begin(); |
984 iter != children_.end(); | 987 iter != children_.end(); |
985 ++iter) { | 988 ++iter) { |
986 state_modified |= (*iter)->CleanupGestureState(); | 989 state_modified |= (*iter)->CleanupGestureState(); |
987 } | 990 } |
988 return state_modified; | 991 return state_modified; |
989 } | 992 } |
990 | 993 |
| 994 std::unique_ptr<cc::CompositorFrameSink> Window::CreateCompositorFrameSink() { |
| 995 return port_->CreateCompositorFrameSink(); |
| 996 } |
| 997 |
| 998 cc::SurfaceId Window::GetSurfaceId() const { |
| 999 return port_->GetSurfaceId(); |
| 1000 } |
| 1001 |
991 void Window::OnPaintLayer(const ui::PaintContext& context) { | 1002 void Window::OnPaintLayer(const ui::PaintContext& context) { |
992 Paint(context); | 1003 Paint(context); |
993 } | 1004 } |
994 | 1005 |
995 void Window::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) { | 1006 void Window::OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) { |
996 DCHECK(layer()); | 1007 DCHECK(layer()); |
997 for (WindowObserver& observer : observers_) | 1008 for (WindowObserver& observer : observers_) |
998 observer.OnDelegatedFrameDamage(this, damage_rect_in_dip); | 1009 observer.OnDelegatedFrameDamage(this, damage_rect_in_dip); |
999 } | 1010 } |
1000 | 1011 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 layer_name = "Unnamed Window"; | 1083 layer_name = "Unnamed Window"; |
1073 | 1084 |
1074 if (id_ != -1) | 1085 if (id_ != -1) |
1075 layer_name += " " + base::IntToString(id_); | 1086 layer_name += " " + base::IntToString(id_); |
1076 | 1087 |
1077 layer()->set_name(layer_name); | 1088 layer()->set_name(layer_name); |
1078 #endif | 1089 #endif |
1079 } | 1090 } |
1080 | 1091 |
1081 } // namespace aura | 1092 } // namespace aura |
OLD | NEW |