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 "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 7 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
8 #include "ui/events/ozone/evdev/device_manager_evdev.h" | |
8 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 9 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
9 #include "ui/ozone/ime/input_method_context_factory_ozone.h" | 10 #include "ui/ozone/ime/input_method_context_factory_ozone.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_factory.h" | 13 #include "ui/ozone/platform/dri/dri_surface_factory.h" |
13 | 14 |
14 #if defined(OS_CHROMEOS) | 15 #if defined(OS_CHROMEOS) |
16 #include "ui/ozone/platform/dri/chromeos/display_event_listener.h" | |
15 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" | 17 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" |
18 #if defined(USE_UDEV) | |
spang
2014/04/25 19:52:26
OS_CHROMEOS implies USE_UDEV
| |
19 #include "ui/events/ozone/device_udev.h" | |
20 #include "ui/ozone/platform/dri/chromeos/display_event_listener_udev.h" | |
21 #endif // defined(USE_UDEV) | |
22 #endif // defined(OS_CHROMEOS) | |
23 | |
24 #if defined(USE_UDEV) | |
25 #include "ui/events/ozone/evdev/device_manager_udev.h" | |
16 #endif | 26 #endif |
17 | 27 |
18 namespace ui { | 28 namespace ui { |
19 | 29 |
20 namespace { | 30 namespace { |
21 | 31 |
22 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) | 32 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) |
23 // | 33 // |
24 // This platform is Linux without any display server (no X, wayland, or | 34 // This platform is Linux without any display server (no X, wayland, or |
25 // anything). This means chrome alone owns the display and input devices. | 35 // anything). This means chrome alone owns the display and input devices. |
26 class OzonePlatformDri : public OzonePlatform { | 36 class OzonePlatformDri : public OzonePlatform { |
27 public: | 37 public: |
28 OzonePlatformDri() | 38 OzonePlatformDri() |
29 : cursor_factory_ozone_(&surface_factory_ozone_), | 39 : cursor_factory_ozone_(&surface_factory_ozone_), |
30 event_factory_ozone_(&cursor_factory_ozone_) {} | 40 event_factory_ozone_(&cursor_factory_ozone_, |
41 #if defined(USE_UDEV) | |
42 CreateDeviceManagerUdev(&udev_) | |
43 #else | |
44 CreateDeviceManagerManual() | |
45 #endif | |
spang
2014/04/25 19:50:28
This is too much.
We could remove DRI from the "e
| |
46 ) {} | |
31 virtual ~OzonePlatformDri() {} | 47 virtual ~OzonePlatformDri() {} |
32 | 48 |
33 // OzonePlatform: | 49 // OzonePlatform: |
34 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { | 50 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { |
35 return &surface_factory_ozone_; | 51 return &surface_factory_ozone_; |
36 } | 52 } |
37 virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { | 53 virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { |
38 return &event_factory_ozone_; | 54 return &event_factory_ozone_; |
39 } | 55 } |
40 virtual ui::InputMethodContextFactoryOzone* | 56 virtual ui::InputMethodContextFactoryOzone* |
41 GetInputMethodContextFactoryOzone() OVERRIDE { | 57 GetInputMethodContextFactoryOzone() OVERRIDE { |
42 return &input_method_context_factory_ozone_; | 58 return &input_method_context_factory_ozone_; |
43 } | 59 } |
44 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { | 60 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { |
45 return &cursor_factory_ozone_; | 61 return &cursor_factory_ozone_; |
46 } | 62 } |
47 #if defined(OS_CHROMEOS) | 63 #if defined(OS_CHROMEOS) |
48 virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() | 64 virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() |
49 OVERRIDE { | 65 OVERRIDE { |
66 scoped_ptr<DisplayEventListener> display_listener; | |
67 #if defined(USE_UDEV) | |
68 display_listener.reset(new DisplayEventListenerUdev(&udev_)); | |
69 #else | |
70 NOTIMPLEMENTED() << "No DisplayEventListener implementation present."; | |
71 #endif | |
72 | |
50 return scoped_ptr<ui::NativeDisplayDelegate>( | 73 return scoped_ptr<ui::NativeDisplayDelegate>( |
51 new NativeDisplayDelegateDri(&surface_factory_ozone_)); | 74 new NativeDisplayDelegateDri(&surface_factory_ozone_, |
75 display_listener.Pass())); | |
52 } | 76 } |
53 #endif | 77 #endif |
54 | 78 |
55 private: | 79 private: |
80 #if defined(USE_UDEV) | |
81 DeviceUdev udev_; | |
82 #endif | |
83 | |
56 ui::DriSurfaceFactory surface_factory_ozone_; | 84 ui::DriSurfaceFactory surface_factory_ozone_; |
57 ui::CursorFactoryEvdevDri cursor_factory_ozone_; | 85 ui::CursorFactoryEvdevDri cursor_factory_ozone_; |
58 ui::EventFactoryEvdev event_factory_ozone_; | 86 ui::EventFactoryEvdev event_factory_ozone_; |
59 // This creates a minimal input context. | 87 // This creates a minimal input context. |
60 ui::InputMethodContextFactoryOzone input_method_context_factory_ozone_; | 88 ui::InputMethodContextFactoryOzone input_method_context_factory_ozone_; |
61 | 89 |
62 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); | 90 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); |
63 }; | 91 }; |
64 | 92 |
65 } // namespace | 93 } // namespace |
66 | 94 |
67 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } | 95 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } |
68 | 96 |
69 } // namespace ui | 97 } // namespace ui |
OLD | NEW |