OLD | NEW |
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/ozone/platform/dri/ozone_platform_dri.h" | 5 #include "ui/ozone/platform/dri/ozone_platform_dri.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "ui/events/ozone/device/device_manager.h" | 8 #include "ui/events/ozone/device/device_manager.h" |
9 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 9 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
10 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 10 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
11 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" | 11 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" |
12 #include "ui/ozone/platform/dri/dri_buffer.h" | 12 #include "ui/ozone/platform/dri/dri_buffer.h" |
13 #include "ui/ozone/platform/dri/dri_surface_factory.h" | 13 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
14 #include "ui/ozone/platform/dri/dri_window.h" | 14 #include "ui/ozone/platform/dri/dri_window.h" |
| 15 #include "ui/ozone/platform/dri/dri_window_delegate_impl.h" |
| 16 #include "ui/ozone/platform/dri/dri_window_manager.h" |
15 #include "ui/ozone/platform/dri/dri_wrapper.h" | 17 #include "ui/ozone/platform/dri/dri_wrapper.h" |
16 #include "ui/ozone/platform/dri/screen_manager.h" | 18 #include "ui/ozone/platform/dri/screen_manager.h" |
17 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" | 19 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" |
18 #include "ui/ozone/public/ozone_platform.h" | 20 #include "ui/ozone/public/ozone_platform.h" |
19 | 21 |
20 #if defined(OS_CHROMEOS) | 22 #if defined(OS_CHROMEOS) |
21 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" | 23 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" |
22 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" | 24 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" |
23 #endif | 25 #endif |
24 | 26 |
(...skipping 30 matching lines...) Expand all Loading... |
55 } | 57 } |
56 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { | 58 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { |
57 return NULL; // no GPU support | 59 return NULL; // no GPU support |
58 } | 60 } |
59 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { | 61 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { |
60 return NULL; // no GPU support | 62 return NULL; // no GPU support |
61 } | 63 } |
62 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( | 64 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( |
63 PlatformWindowDelegate* delegate, | 65 PlatformWindowDelegate* delegate, |
64 const gfx::Rect& bounds) OVERRIDE { | 66 const gfx::Rect& bounds) OVERRIDE { |
65 return scoped_ptr<PlatformWindow>( | 67 scoped_ptr<DriWindow> platform_window(new DriWindow( |
66 new DriWindow(delegate, | 68 delegate, |
67 bounds, | 69 bounds, |
68 surface_factory_ozone_.get(), | 70 scoped_ptr<DriWindowDelegate>(new DriWindowDelegateImpl( |
69 event_factory_ozone_.get())); | 71 window_manager_.NextAcceleratedWidget(), screen_manager_.get())), |
| 72 event_factory_ozone_.get(), |
| 73 &window_manager_)); |
| 74 platform_window->Initialize(); |
| 75 return platform_window.PassAs<PlatformWindow>(); |
70 } | 76 } |
71 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
72 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 78 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
73 OVERRIDE { | 79 OVERRIDE { |
74 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateDri( | 80 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateDri( |
75 dri_.get(), screen_manager_.get(), device_manager_.get())); | 81 dri_.get(), screen_manager_.get(), device_manager_.get())); |
76 } | 82 } |
77 virtual scoped_ptr<TouchscreenDeviceManager> | 83 virtual scoped_ptr<TouchscreenDeviceManager> |
78 CreateTouchscreenDeviceManager() OVERRIDE { | 84 CreateTouchscreenDeviceManager() OVERRIDE { |
79 return scoped_ptr<TouchscreenDeviceManager>( | 85 return scoped_ptr<TouchscreenDeviceManager>( |
80 new TouchscreenDeviceManagerOzone()); | 86 new TouchscreenDeviceManagerOzone()); |
81 } | 87 } |
82 #endif | 88 #endif |
83 virtual void InitializeUI() OVERRIDE { | 89 virtual void InitializeUI() OVERRIDE { |
84 surface_factory_ozone_.reset( | 90 surface_factory_ozone_.reset(new DriSurfaceFactory( |
85 new DriSurfaceFactory(dri_.get(), screen_manager_.get())); | 91 dri_.get(), screen_manager_.get(), &window_manager_)); |
86 cursor_factory_ozone_.reset( | 92 cursor_factory_ozone_.reset( |
87 new CursorFactoryEvdevDri(surface_factory_ozone_.get())); | 93 new CursorFactoryEvdevDri(surface_factory_ozone_.get())); |
88 event_factory_ozone_.reset(new EventFactoryEvdev( | 94 event_factory_ozone_.reset(new EventFactoryEvdev( |
89 cursor_factory_ozone_.get(), device_manager_.get())); | 95 cursor_factory_ozone_.get(), device_manager_.get())); |
90 if (surface_factory_ozone_->InitializeHardware() != | 96 if (surface_factory_ozone_->InitializeHardware() != |
91 DriSurfaceFactory::INITIALIZED) | 97 DriSurfaceFactory::INITIALIZED) |
92 LOG(FATAL) << "failed to initialize display hardware"; | 98 LOG(FATAL) << "failed to initialize display hardware"; |
93 | 99 |
94 } | 100 } |
95 | 101 |
96 virtual void InitializeGPU() OVERRIDE {} | 102 virtual void InitializeGPU() OVERRIDE {} |
97 | 103 |
98 private: | 104 private: |
99 scoped_ptr<VirtualTerminalManager> vt_manager_; | 105 scoped_ptr<VirtualTerminalManager> vt_manager_; |
100 scoped_ptr<DriWrapper> dri_; | 106 scoped_ptr<DriWrapper> dri_; |
101 scoped_ptr<DriBufferGenerator> buffer_generator_; | 107 scoped_ptr<DriBufferGenerator> buffer_generator_; |
102 scoped_ptr<ScreenManager> screen_manager_; | 108 scoped_ptr<ScreenManager> screen_manager_; |
103 scoped_ptr<DeviceManager> device_manager_; | 109 scoped_ptr<DeviceManager> device_manager_; |
104 | 110 |
105 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; | 111 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; |
106 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; | 112 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; |
107 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 113 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
108 | 114 |
| 115 DriWindowManager window_manager_; |
| 116 |
109 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); | 117 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); |
110 }; | 118 }; |
111 | 119 |
112 } // namespace | 120 } // namespace |
113 | 121 |
114 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } | 122 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } |
115 | 123 |
116 } // namespace ui | 124 } // namespace ui |
OLD | NEW |