Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / ui / ozone / platform / caca / ozone_platform_caca.cc
blob3a5a3e9b769ae81ecd87886ec5a5044d29e9c38f
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
3 // found in the LICENSE file.
5 #include "ui/ozone/platform/caca/ozone_platform_caca.h"
7 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
8 #include "ui/events/ozone/layout/no/no_keyboard_layout_engine.h"
9 #include "ui/ozone/common/native_display_delegate_ozone.h"
10 #include "ui/ozone/common/stub_overlay_manager.h"
11 #include "ui/ozone/platform/caca/caca_event_source.h"
12 #include "ui/ozone/platform/caca/caca_window.h"
13 #include "ui/ozone/platform/caca/caca_window_manager.h"
14 #include "ui/ozone/public/cursor_factory_ozone.h"
15 #include "ui/ozone/public/gpu_platform_support.h"
16 #include "ui/ozone/public/gpu_platform_support_host.h"
17 #include "ui/ozone/public/input_controller.h"
18 #include "ui/ozone/public/ozone_platform.h"
19 #include "ui/ozone/public/system_input_injector.h"
21 namespace ui {
23 namespace {
25 class OzonePlatformCaca : public OzonePlatform {
26 public:
27 OzonePlatformCaca() {}
28 ~OzonePlatformCaca() override {}
30 // OzonePlatform:
31 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
32 return window_manager_.get();
34 OverlayManagerOzone* GetOverlayManager() override {
35 return overlay_manager_.get();
37 CursorFactoryOzone* GetCursorFactoryOzone() override {
38 return cursor_factory_ozone_.get();
40 InputController* GetInputController() override {
41 return input_controller_.get();
43 GpuPlatformSupport* GetGpuPlatformSupport() override {
44 return gpu_platform_support_.get();
46 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
47 return gpu_platform_support_host_.get();
49 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override {
50 return nullptr; // no input injection support.
52 scoped_ptr<PlatformWindow> CreatePlatformWindow(
53 PlatformWindowDelegate* delegate,
54 const gfx::Rect& bounds) override {
55 scoped_ptr<CacaWindow> caca_window(new CacaWindow(
56 delegate, window_manager_.get(), event_source_.get(), bounds));
57 if (!caca_window->Initialize())
58 return nullptr;
59 return caca_window.Pass();
61 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override {
62 return make_scoped_ptr(new NativeDisplayDelegateOzone());
64 base::ScopedFD OpenClientNativePixmapDevice() const override {
65 return base::ScopedFD();
68 void InitializeUI() override {
69 window_manager_.reset(new CacaWindowManager);
70 overlay_manager_.reset(new StubOverlayManager());
71 event_source_.reset(new CacaEventSource());
72 cursor_factory_ozone_.reset(new CursorFactoryOzone());
73 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
74 input_controller_ = CreateStubInputController();
75 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
76 make_scoped_ptr(new NoKeyboardLayoutEngine()));
79 void InitializeGPU() override {
80 gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
83 private:
84 scoped_ptr<CacaWindowManager> window_manager_;
85 scoped_ptr<CacaEventSource> event_source_;
86 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
87 scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
88 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
89 scoped_ptr<InputController> input_controller_;
90 scoped_ptr<OverlayManagerOzone> overlay_manager_;
92 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca);
95 } // namespace
97 OzonePlatform* CreateOzonePlatformCaca() {
98 return new OzonePlatformCaca;
101 } // namespace ui