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