Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: ui/aura/window_tree_host_ozone.cc

Issue 205433005: ozone: Add OzoneWindowFactory & OzoneWindow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_tree_host_ozone.h" 5 #include "ui/aura/window_tree_host_ozone.h"
6 6
7 #include "ui/aura/window_event_dispatcher.h" 7 #include "ui/aura/window_event_dispatcher.h"
8 #include "ui/base/cursor/ozone/cursor_factory_ozone.h"
9 #include "ui/events/ozone/event_factory_ozone.h"
10 #include "ui/gfx/ozone/surface_factory_ozone.h"
11 #include "ui/ozone/ozone_platform.h" 8 #include "ui/ozone/ozone_platform.h"
9 #include "ui/ozone/window/ozone_window.h"
10 #include "ui/ozone/window/window_factory_ozone.h"
12 11
13 namespace aura { 12 namespace aura {
14 13
15 WindowTreeHostOzone::WindowTreeHostOzone(const gfx::Rect& bounds) 14 WindowTreeHostOzone::WindowTreeHostOzone(
16 : widget_(0), 15 scoped_ptr<ui::OzoneWindow> ozone_window)
17 bounds_(bounds) { 16 : ozone_window_(ozone_window.Pass()) {
18 ui::OzonePlatform::Initialize(); 17 // TODO(spang): Don't use EventFactoryOzone here. We should do
19 18 // something like: window_->AddPlatformEventDispatcherHandlerController(this);
20 // EventFactoryOzone creates converters that obtain input events from the
21 // underlying input system and dispatch them as |ui::Event| instances into
22 // Aura.
23 ui::EventFactoryOzone::GetInstance()->StartProcessingEvents(); 19 ui::EventFactoryOzone::GetInstance()->StartProcessingEvents();
24 20
25 gfx::SurfaceFactoryOzone* surface_factory =
26 gfx::SurfaceFactoryOzone::GetInstance();
27 widget_ = surface_factory->GetAcceleratedWidget();
28
29 base::MessagePumpOzone::Current()->AddDispatcherForRootWindow(this); 21 base::MessagePumpOzone::Current()->AddDispatcherForRootWindow(this);
30 CreateCompositor(GetAcceleratedWidget()); 22 CreateCompositor(GetAcceleratedWidget());
31 } 23 }
32 24
33 WindowTreeHostOzone::~WindowTreeHostOzone() { 25 WindowTreeHostOzone::~WindowTreeHostOzone() {
34 base::MessagePumpOzone::Current()->RemoveDispatcherForRootWindow(0); 26 base::MessagePumpOzone::Current()->RemoveDispatcherForRootWindow(0);
35 DestroyCompositor(); 27 DestroyCompositor();
36 DestroyDispatcher(); 28 DestroyDispatcher();
37 } 29 }
38 30
39 uint32_t WindowTreeHostOzone::Dispatch(const base::NativeEvent& ne) { 31 uint32_t WindowTreeHostOzone::Dispatch(const base::NativeEvent& ne) {
40 ui::Event* event = static_cast<ui::Event*>(ne); 32 ui::Event* event = static_cast<ui::Event*>(ne);
41 ui::EventDispatchDetails details ALLOW_UNUSED = SendEventToProcessor(event); 33 ui::EventDispatchDetails details ALLOW_UNUSED = SendEventToProcessor(event);
42 return POST_DISPATCH_NONE; 34 return POST_DISPATCH_NONE;
43 } 35 }
44 36
45 gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() { 37 gfx::AcceleratedWidget WindowTreeHostOzone::GetAcceleratedWidget() {
46 return widget_; 38 return ozone_window_->GetAcceleratedWidget();
47 } 39 }
48 40
49 void WindowTreeHostOzone::Show() { NOTIMPLEMENTED(); } 41 void WindowTreeHostOzone::Show() { NOTIMPLEMENTED(); }
50 42
51 void WindowTreeHostOzone::Hide() { NOTIMPLEMENTED(); } 43 void WindowTreeHostOzone::Hide() { NOTIMPLEMENTED(); }
52 44
53 void WindowTreeHostOzone::ToggleFullScreen() { NOTIMPLEMENTED(); } 45 void WindowTreeHostOzone::ToggleFullScreen() { NOTIMPLEMENTED(); }
54 46
55 gfx::Rect WindowTreeHostOzone::GetBounds() const { return bounds_; } 47 gfx::Rect WindowTreeHostOzone::GetBounds() const {
48 return ozone_window_->GetBounds();
49 }
56 50
57 void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) { 51 void WindowTreeHostOzone::SetBounds(const gfx::Rect& bounds) {
58 NOTIMPLEMENTED(); 52 NOTIMPLEMENTED();
59 } 53 }
60 54
61 gfx::Insets WindowTreeHostOzone::GetInsets() const { return gfx::Insets(); } 55 gfx::Insets WindowTreeHostOzone::GetInsets() const { return gfx::Insets(); }
62 56
63 void WindowTreeHostOzone::SetInsets(const gfx::Insets& insets) { 57 void WindowTreeHostOzone::SetInsets(const gfx::Insets& insets) {
64 NOTIMPLEMENTED(); 58 NOTIMPLEMENTED();
65 } 59 }
66 60
67 gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const { 61 gfx::Point WindowTreeHostOzone::GetLocationOnNativeScreen() const {
68 return bounds_.origin(); 62 return gfx::Point();
69 } 63 }
70 64
71 void WindowTreeHostOzone::SetCapture() { NOTIMPLEMENTED(); } 65 void WindowTreeHostOzone::SetCapture() { NOTIMPLEMENTED(); }
72 66
73 void WindowTreeHostOzone::ReleaseCapture() { NOTIMPLEMENTED(); } 67 void WindowTreeHostOzone::ReleaseCapture() { NOTIMPLEMENTED(); }
74 68
75 bool WindowTreeHostOzone::QueryMouseLocation(gfx::Point* location_return) { 69 bool WindowTreeHostOzone::QueryMouseLocation(gfx::Point* location_return) {
76 NOTIMPLEMENTED(); 70 NOTIMPLEMENTED();
77 return false; 71 return false;
78 } 72 }
(...skipping 11 matching lines...) Expand all
90 } 84 }
91 85
92 void WindowTreeHostOzone::OnDeviceScaleFactorChanged( 86 void WindowTreeHostOzone::OnDeviceScaleFactorChanged(
93 float device_scale_factor) { 87 float device_scale_factor) {
94 NOTIMPLEMENTED(); 88 NOTIMPLEMENTED();
95 } 89 }
96 90
97 void WindowTreeHostOzone::PrepareForShutdown() { NOTIMPLEMENTED(); } 91 void WindowTreeHostOzone::PrepareForShutdown() { NOTIMPLEMENTED(); }
98 92
99 void WindowTreeHostOzone::SetCursorNative(gfx::NativeCursor cursor) { 93 void WindowTreeHostOzone::SetCursorNative(gfx::NativeCursor cursor) {
100 ui::CursorFactoryOzone::GetInstance()->SetCursor(GetAcceleratedWidget(), 94 ozone_window_->SetCursor(cursor.platform());
101 cursor.platform());
102 } 95 }
103 96
104 void WindowTreeHostOzone::MoveCursorToNative(const gfx::Point& location) { 97 void WindowTreeHostOzone::MoveCursorToNative(const gfx::Point& location) {
105 ui::EventFactoryOzone::GetInstance()->WarpCursorTo(GetAcceleratedWidget(), 98 ozone_window_->WarpCursorTo(location);
106 location);
107 } 99 }
108 100
109 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) { 101 void WindowTreeHostOzone::OnCursorVisibilityChangedNative(bool show) {
110 NOTIMPLEMENTED(); 102 NOTIMPLEMENTED();
111 } 103 }
112 104
113 ui::EventProcessor* WindowTreeHostOzone::GetEventProcessor() { 105 ui::EventProcessor* WindowTreeHostOzone::GetEventProcessor() {
114 return dispatcher(); 106 return dispatcher();
115 } 107 }
116 108
117 // static 109 // static
118 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { 110 WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) {
119 return new WindowTreeHostOzone(bounds); 111 ui::OzonePlatform::Initialize();
112 scoped_ptr<ui::OzoneWindow> ozone_window =
113 ui::WindowFactoryOzone::GetInstance()->CreateWindow(bounds);
114 return new WindowTreeHostOzone(ozone_window.Pass());
120 } 115 }
121 116
122 // static 117 // static
123 gfx::Size WindowTreeHost::GetNativeScreenSize() { 118 gfx::Size WindowTreeHost::GetNativeScreenSize() {
124 NOTIMPLEMENTED(); 119 NOTIMPLEMENTED();
125 return gfx::Size(); 120 return gfx::Size();
126 } 121 }
127 122
128 } // namespace aura 123 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698