| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/caca/ozone_platform_caca.h" | 5 #include "ui/ozone/platform/caca/ozone_platform_caca.h" |
| 6 | 6 |
| 7 #include "ui/ozone/common/native_display_delegate_ozone.h" | 7 #include "ui/ozone/common/native_display_delegate_ozone.h" |
| 8 #include "ui/ozone/platform/caca/caca_event_source.h" | 8 #include "ui/ozone/platform/caca/caca_event_source.h" |
| 9 #include "ui/ozone/platform/caca/caca_window.h" | 9 #include "ui/ozone/platform/caca/caca_window.h" |
| 10 #include "ui/ozone/platform/caca/caca_window_manager.h" | 10 #include "ui/ozone/platform/caca/caca_window_manager.h" |
| 11 #include "ui/ozone/public/cursor_factory_ozone.h" | 11 #include "ui/ozone/public/cursor_factory_ozone.h" |
| 12 #include "ui/ozone/public/gpu_platform_support.h" | 12 #include "ui/ozone/public/gpu_platform_support.h" |
| 13 #include "ui/ozone/public/gpu_platform_support_host.h" | 13 #include "ui/ozone/public/gpu_platform_support_host.h" |
| 14 #include "ui/ozone/public/input_controller.h" |
| 14 #include "ui/ozone/public/ozone_platform.h" | 15 #include "ui/ozone/public/ozone_platform.h" |
| 15 #include "ui/ozone/public/system_input_injector.h" | 16 #include "ui/ozone/public/system_input_injector.h" |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| 21 class OzonePlatformCaca : public OzonePlatform { | 22 class OzonePlatformCaca : public OzonePlatform { |
| 22 public: | 23 public: |
| 23 OzonePlatformCaca() {} | 24 OzonePlatformCaca() {} |
| 24 ~OzonePlatformCaca() override {} | 25 ~OzonePlatformCaca() override {} |
| 25 | 26 |
| 26 // OzonePlatform: | 27 // OzonePlatform: |
| 27 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { | 28 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { |
| 28 return window_manager_.get(); | 29 return window_manager_.get(); |
| 29 } | 30 } |
| 30 CursorFactoryOzone* GetCursorFactoryOzone() override { | 31 CursorFactoryOzone* GetCursorFactoryOzone() override { |
| 31 return cursor_factory_ozone_.get(); | 32 return cursor_factory_ozone_.get(); |
| 32 } | 33 } |
| 33 InputController* GetInputController() override { | 34 InputController* GetInputController() override { |
| 34 return nullptr; // no input setting need | 35 return input_controller_.get(); |
| 35 } | 36 } |
| 36 GpuPlatformSupport* GetGpuPlatformSupport() override { | 37 GpuPlatformSupport* GetGpuPlatformSupport() override { |
| 37 return gpu_platform_support_.get(); | 38 return gpu_platform_support_.get(); |
| 38 } | 39 } |
| 39 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 40 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
| 40 return gpu_platform_support_host_.get(); | 41 return gpu_platform_support_host_.get(); |
| 41 } | 42 } |
| 42 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { | 43 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { |
| 43 return nullptr; // no input injection support. | 44 return nullptr; // no input injection support. |
| 44 } | 45 } |
| 45 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 46 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 46 PlatformWindowDelegate* delegate, | 47 PlatformWindowDelegate* delegate, |
| 47 const gfx::Rect& bounds) override { | 48 const gfx::Rect& bounds) override { |
| 48 scoped_ptr<CacaWindow> caca_window(new CacaWindow( | 49 scoped_ptr<CacaWindow> caca_window(new CacaWindow( |
| 49 delegate, window_manager_.get(), event_source_.get(), bounds)); | 50 delegate, window_manager_.get(), event_source_.get(), bounds)); |
| 50 if (!caca_window->Initialize()) | 51 if (!caca_window->Initialize()) |
| 51 return nullptr; | 52 return nullptr; |
| 52 return caca_window.Pass(); | 53 return caca_window.Pass(); |
| 53 } | 54 } |
| 54 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 55 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
| 55 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 56 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void InitializeUI() override { | 59 void InitializeUI() override { |
| 59 window_manager_.reset(new CacaWindowManager); | 60 window_manager_.reset(new CacaWindowManager); |
| 60 event_source_.reset(new CacaEventSource()); | 61 event_source_.reset(new CacaEventSource()); |
| 61 cursor_factory_ozone_.reset(new CursorFactoryOzone()); | 62 cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
| 62 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 63 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 64 input_controller_ = CreateStubInputController(); |
| 63 } | 65 } |
| 64 | 66 |
| 65 void InitializeGPU() override { | 67 void InitializeGPU() override { |
| 66 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 68 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
| 67 } | 69 } |
| 68 | 70 |
| 69 private: | 71 private: |
| 70 scoped_ptr<CacaWindowManager> window_manager_; | 72 scoped_ptr<CacaWindowManager> window_manager_; |
| 71 scoped_ptr<CacaEventSource> event_source_; | 73 scoped_ptr<CacaEventSource> event_source_; |
| 72 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; | 74 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
| 73 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; | 75 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; |
| 74 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 76 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 77 scoped_ptr<InputController> input_controller_; |
| 75 | 78 |
| 76 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); | 79 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); |
| 77 }; | 80 }; |
| 78 | 81 |
| 79 } // namespace | 82 } // namespace |
| 80 | 83 |
| 81 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } | 84 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } |
| 82 | 85 |
| 83 } // namespace ui | 86 } // namespace ui |
| OLD | NEW |