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 "ui/events/ozone/device/device_manager.h" | 8 #include "ui/events/ozone/device/device_manager.h" |
8 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 9 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
9 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 10 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
10 #include "ui/ozone/ozone_platform.h" | 11 #include "ui/ozone/ozone_platform.h" |
11 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" | 12 #include "ui/ozone/platform/dri/cursor_factory_evdev_dri.h" |
12 #include "ui/ozone/platform/dri/dri_surface.h" | 13 #include "ui/ozone/platform/dri/dri_surface.h" |
13 #include "ui/ozone/platform/dri/dri_surface_factory.h" | 14 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
14 #include "ui/ozone/platform/dri/dri_wrapper.h" | 15 #include "ui/ozone/platform/dri/dri_wrapper.h" |
15 #include "ui/ozone/platform/dri/scanout_surface.h" | 16 #include "ui/ozone/platform/dri/scanout_surface.h" |
16 #include "ui/ozone/platform/dri/screen_manager.h" | 17 #include "ui/ozone/platform/dri/screen_manager.h" |
| 18 #include "ui/ozone/platform/dri/virtual_terminal_manager.h" |
17 | 19 |
18 #if defined(OS_CHROMEOS) | 20 #if defined(OS_CHROMEOS) |
19 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" | 21 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" |
20 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" | 22 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" |
21 #endif | 23 #endif |
22 | 24 |
23 namespace ui { | 25 namespace ui { |
24 | 26 |
25 namespace { | 27 namespace { |
26 | 28 |
(...skipping 14 matching lines...) Expand all Loading... |
41 DISALLOW_COPY_AND_ASSIGN(DriSurfaceGenerator); | 43 DISALLOW_COPY_AND_ASSIGN(DriSurfaceGenerator); |
42 }; | 44 }; |
43 | 45 |
44 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) | 46 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) |
45 // | 47 // |
46 // This platform is Linux without any display server (no X, wayland, or | 48 // This platform is Linux without any display server (no X, wayland, or |
47 // anything). This means chrome alone owns the display and input devices. | 49 // anything). This means chrome alone owns the display and input devices. |
48 class OzonePlatformDri : public OzonePlatform { | 50 class OzonePlatformDri : public OzonePlatform { |
49 public: | 51 public: |
50 OzonePlatformDri() | 52 OzonePlatformDri() |
51 : dri_(new DriWrapper(kDefaultGraphicsCardPath)), | 53 : vt_manager_(new VirtualTerminalManager()), |
| 54 dri_(new DriWrapper(kDefaultGraphicsCardPath)), |
52 surface_generator_(new DriSurfaceGenerator(dri_.get())), | 55 surface_generator_(new DriSurfaceGenerator(dri_.get())), |
53 screen_manager_(new ScreenManager(dri_.get(), | 56 screen_manager_(new ScreenManager(dri_.get(), |
54 surface_generator_.get())), | 57 surface_generator_.get())), |
55 device_manager_(CreateDeviceManager()) {} | 58 device_manager_(CreateDeviceManager()) { |
| 59 base::AtExitManager::RegisterTask( |
| 60 base::Bind(&base::DeletePointer<OzonePlatformDri>, this)); |
| 61 } |
56 virtual ~OzonePlatformDri() {} | 62 virtual ~OzonePlatformDri() {} |
57 | 63 |
58 // OzonePlatform: | 64 // OzonePlatform: |
59 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { | 65 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { |
60 return surface_factory_ozone_.get(); | 66 return surface_factory_ozone_.get(); |
61 } | 67 } |
62 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { | 68 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { |
63 return event_factory_ozone_.get(); | 69 return event_factory_ozone_.get(); |
64 } | 70 } |
65 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { | 71 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { |
(...skipping 16 matching lines...) Expand all Loading... |
82 new DriSurfaceFactory(dri_.get(), screen_manager_.get())); | 88 new DriSurfaceFactory(dri_.get(), screen_manager_.get())); |
83 cursor_factory_ozone_.reset( | 89 cursor_factory_ozone_.reset( |
84 new CursorFactoryEvdevDri(surface_factory_ozone_.get())); | 90 new CursorFactoryEvdevDri(surface_factory_ozone_.get())); |
85 event_factory_ozone_.reset(new EventFactoryEvdev( | 91 event_factory_ozone_.reset(new EventFactoryEvdev( |
86 cursor_factory_ozone_.get(), device_manager_.get())); | 92 cursor_factory_ozone_.get(), device_manager_.get())); |
87 } | 93 } |
88 | 94 |
89 virtual void InitializeGPU() OVERRIDE {} | 95 virtual void InitializeGPU() OVERRIDE {} |
90 | 96 |
91 private: | 97 private: |
| 98 scoped_ptr<VirtualTerminalManager> vt_manager_; |
92 scoped_ptr<DriWrapper> dri_; | 99 scoped_ptr<DriWrapper> dri_; |
93 scoped_ptr<DriSurfaceGenerator> surface_generator_; | 100 scoped_ptr<DriSurfaceGenerator> surface_generator_; |
94 // TODO(dnicoara) Move ownership of |screen_manager_| to NDD. | |
95 scoped_ptr<ScreenManager> screen_manager_; | 101 scoped_ptr<ScreenManager> screen_manager_; |
96 scoped_ptr<DeviceManager> device_manager_; | 102 scoped_ptr<DeviceManager> device_manager_; |
97 | 103 |
98 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; | 104 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; |
99 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; | 105 scoped_ptr<CursorFactoryEvdevDri> cursor_factory_ozone_; |
100 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 106 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
101 | 107 |
102 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); | 108 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); |
103 }; | 109 }; |
104 | 110 |
105 } // namespace | 111 } // namespace |
106 | 112 |
107 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } | 113 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } |
108 | 114 |
109 } // namespace ui | 115 } // namespace ui |
OLD | NEW |