Revert of Roll src/third_party/WebKit e0eac24:489c548 (svn 193311:193320) (patchset...
[chromium-blink-merge.git] / ui / ozone / platform / caca / ozone_platform_caca.cc
bloba0186a6a77d480f427a9285936606a17d6d2c17a
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/platform/caca/caca_event_source.h"
11 #include "ui/ozone/platform/caca/caca_window.h"
12 #include "ui/ozone/platform/caca/caca_window_manager.h"
13 #include "ui/ozone/public/cursor_factory_ozone.h"
14 #include "ui/ozone/public/gpu_platform_support.h"
15 #include "ui/ozone/public/gpu_platform_support_host.h"
16 #include "ui/ozone/public/input_controller.h"
17 #include "ui/ozone/public/ozone_platform.h"
18 #include "ui/ozone/public/system_input_injector.h"
20 namespace ui {
22 namespace {
24 class OzonePlatformCaca : public OzonePlatform {
25 public:
26 OzonePlatformCaca() {}
27 ~OzonePlatformCaca() override {}
29 // OzonePlatform:
30 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
31 return window_manager_.get();
33 CursorFactoryOzone* GetCursorFactoryOzone() override {
34 return cursor_factory_ozone_.get();
36 InputController* GetInputController() override {
37 return input_controller_.get();
39 GpuPlatformSupport* GetGpuPlatformSupport() override {
40 return gpu_platform_support_.get();
42 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
43 return gpu_platform_support_host_.get();
45 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override {
46 return nullptr; // no input injection support.
48 scoped_ptr<PlatformWindow> CreatePlatformWindow(
49 PlatformWindowDelegate* delegate,
50 const gfx::Rect& bounds) override {
51 scoped_ptr<CacaWindow> caca_window(new CacaWindow(
52 delegate, window_manager_.get(), event_source_.get(), bounds));
53 if (!caca_window->Initialize())
54 return nullptr;
55 return caca_window.Pass();
57 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override {
58 return make_scoped_ptr(new NativeDisplayDelegateOzone());
61 void InitializeUI() override {
62 window_manager_.reset(new CacaWindowManager);
63 event_source_.reset(new CacaEventSource());
64 cursor_factory_ozone_.reset(new CursorFactoryOzone());
65 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
66 input_controller_ = CreateStubInputController();
67 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
68 make_scoped_ptr(new NoKeyboardLayoutEngine()));
71 void InitializeGPU() override {
72 gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
75 private:
76 scoped_ptr<CacaWindowManager> window_manager_;
77 scoped_ptr<CacaEventSource> event_source_;
78 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
79 scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
80 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
81 scoped_ptr<InputController> input_controller_;
83 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca);
86 } // namespace
88 OzonePlatform* CreateOzonePlatformCaca() {
89 return new OzonePlatformCaca;
92 } // namespace ui