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/device/device_manager.h" |
7 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 8 #include "ui/events/ozone/evdev/cursor_delegate_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) |
15 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" | 16 #include "ui/ozone/platform/dri/chromeos/native_display_delegate_dri.h" |
16 #endif | 17 #endif |
17 | 18 |
18 namespace ui { | 19 namespace ui { |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) | 23 // OzonePlatform for Linux DRI (Direct Rendering Infrastructure) |
23 // | 24 // |
24 // This platform is Linux without any display server (no X, wayland, or | 25 // This platform is Linux without any display server (no X, wayland, or |
25 // anything). This means chrome alone owns the display and input devices. | 26 // anything). This means chrome alone owns the display and input devices. |
26 class OzonePlatformDri : public OzonePlatform { | 27 class OzonePlatformDri : public OzonePlatform { |
27 public: | 28 public: |
28 OzonePlatformDri() | 29 OzonePlatformDri() |
29 : cursor_factory_ozone_(&surface_factory_ozone_), | 30 : device_manager_(CreateDeviceManager()), |
30 event_factory_ozone_(&cursor_factory_ozone_) {} | 31 cursor_factory_ozone_(&surface_factory_ozone_), |
| 32 event_factory_ozone_(&cursor_factory_ozone_, device_manager_.get()) {} |
31 virtual ~OzonePlatformDri() {} | 33 virtual ~OzonePlatformDri() {} |
32 | 34 |
33 // OzonePlatform: | 35 // OzonePlatform: |
34 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { | 36 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { |
35 return &surface_factory_ozone_; | 37 return &surface_factory_ozone_; |
36 } | 38 } |
37 virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { | 39 virtual ui::EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { |
38 return &event_factory_ozone_; | 40 return &event_factory_ozone_; |
39 } | 41 } |
40 virtual ui::InputMethodContextFactoryOzone* | 42 virtual ui::InputMethodContextFactoryOzone* |
41 GetInputMethodContextFactoryOzone() OVERRIDE { | 43 GetInputMethodContextFactoryOzone() OVERRIDE { |
42 return &input_method_context_factory_ozone_; | 44 return &input_method_context_factory_ozone_; |
43 } | 45 } |
44 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { | 46 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { |
45 return &cursor_factory_ozone_; | 47 return &cursor_factory_ozone_; |
46 } | 48 } |
47 #if defined(OS_CHROMEOS) | 49 #if defined(OS_CHROMEOS) |
48 virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() | 50 virtual scoped_ptr<ui::NativeDisplayDelegate> CreateNativeDisplayDelegate() |
49 OVERRIDE { | 51 OVERRIDE { |
50 return scoped_ptr<ui::NativeDisplayDelegate>( | 52 return scoped_ptr<ui::NativeDisplayDelegate>( |
51 new NativeDisplayDelegateDri(&surface_factory_ozone_)); | 53 new NativeDisplayDelegateDri(&surface_factory_ozone_, |
| 54 device_manager_.get())); |
52 } | 55 } |
53 #endif | 56 #endif |
54 | 57 |
55 private: | 58 private: |
| 59 scoped_ptr<DeviceManager> device_manager_; |
| 60 |
56 ui::DriSurfaceFactory surface_factory_ozone_; | 61 ui::DriSurfaceFactory surface_factory_ozone_; |
57 ui::CursorFactoryEvdevDri cursor_factory_ozone_; | 62 ui::CursorFactoryEvdevDri cursor_factory_ozone_; |
58 ui::EventFactoryEvdev event_factory_ozone_; | 63 ui::EventFactoryEvdev event_factory_ozone_; |
59 // This creates a minimal input context. | 64 // This creates a minimal input context. |
60 ui::InputMethodContextFactoryOzone input_method_context_factory_ozone_; | 65 ui::InputMethodContextFactoryOzone input_method_context_factory_ozone_; |
61 | 66 |
62 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); | 67 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); |
63 }; | 68 }; |
64 | 69 |
65 } // namespace | 70 } // namespace |
66 | 71 |
67 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } | 72 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } |
68 | 73 |
69 } // namespace ui | 74 } // namespace ui |
OLD | NEW |