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/events/ozone/layout/stub/stub_keyboard_layouts.h" |
7 #include "ui/ozone/common/native_display_delegate_ozone.h" | 8 #include "ui/ozone/common/native_display_delegate_ozone.h" |
8 #include "ui/ozone/platform/caca/caca_event_source.h" | 9 #include "ui/ozone/platform/caca/caca_event_source.h" |
9 #include "ui/ozone/platform/caca/caca_window.h" | 10 #include "ui/ozone/platform/caca/caca_window.h" |
10 #include "ui/ozone/platform/caca/caca_window_manager.h" | 11 #include "ui/ozone/platform/caca/caca_window_manager.h" |
11 #include "ui/ozone/public/cursor_factory_ozone.h" | 12 #include "ui/ozone/public/cursor_factory_ozone.h" |
12 #include "ui/ozone/public/ozone_platform.h" | 13 #include "ui/ozone/public/ozone_platform.h" |
13 | 14 |
14 namespace ui { | 15 namespace ui { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 class OzonePlatformCaca : public OzonePlatform { | 19 class OzonePlatformCaca : public OzonePlatform { |
19 public: | 20 public: |
20 OzonePlatformCaca() {} | 21 OzonePlatformCaca() {} |
21 ~OzonePlatformCaca() override {} | 22 ~OzonePlatformCaca() override {} |
22 | 23 |
23 // OzonePlatform: | 24 // OzonePlatform: |
24 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { | 25 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { |
25 return window_manager_.get(); | 26 return window_manager_.get(); |
26 } | 27 } |
27 CursorFactoryOzone* GetCursorFactoryOzone() override { | 28 CursorFactoryOzone* GetCursorFactoryOzone() override { |
28 return cursor_factory_ozone_.get(); | 29 return cursor_factory_ozone_.get(); |
29 } | 30 } |
30 GpuPlatformSupport* GetGpuPlatformSupport() override { | 31 GpuPlatformSupport* GetGpuPlatformSupport() override { |
31 return NULL; // no GPU support | 32 return NULL; // no GPU support |
32 } | 33 } |
33 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 34 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
34 return NULL; // no GPU support | 35 return NULL; // no GPU support |
35 } | 36 } |
| 37 KeyboardLayoutsOzone* GetKeyboardLayouts() override { |
| 38 return keyboard_layouts_ozone_.get(); |
| 39 } |
36 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 40 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
37 PlatformWindowDelegate* delegate, | 41 PlatformWindowDelegate* delegate, |
38 const gfx::Rect& bounds) override { | 42 const gfx::Rect& bounds) override { |
39 scoped_ptr<CacaWindow> caca_window(new CacaWindow( | 43 scoped_ptr<CacaWindow> caca_window(new CacaWindow( |
40 delegate, window_manager_.get(), event_source_.get(), bounds)); | 44 delegate, window_manager_.get(), event_source_.get(), bounds)); |
41 if (!caca_window->Initialize()) | 45 if (!caca_window->Initialize()) |
42 return nullptr; | 46 return nullptr; |
43 return caca_window.Pass(); | 47 return caca_window.Pass(); |
44 } | 48 } |
45 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 49 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
46 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 50 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
47 } | 51 } |
48 | 52 |
49 void InitializeUI() override { | 53 void InitializeUI() override { |
50 window_manager_.reset(new CacaWindowManager); | 54 window_manager_.reset(new CacaWindowManager); |
51 event_source_.reset(new CacaEventSource()); | 55 event_source_.reset(new CacaEventSource()); |
52 cursor_factory_ozone_.reset(new CursorFactoryOzone()); | 56 cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
| 57 keyboard_layouts_ozone_.reset(new StubKeyboardLayouts()); |
53 } | 58 } |
54 | 59 |
55 void InitializeGPU() override {} | 60 void InitializeGPU() override {} |
56 | 61 |
57 private: | 62 private: |
58 scoped_ptr<CacaWindowManager> window_manager_; | 63 scoped_ptr<CacaWindowManager> window_manager_; |
59 scoped_ptr<CacaEventSource> event_source_; | 64 scoped_ptr<CacaEventSource> event_source_; |
60 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; | 65 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
| 66 scoped_ptr<KeyboardLayoutsOzone> keyboard_layouts_ozone_; |
61 | 67 |
62 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); | 68 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); |
63 }; | 69 }; |
64 | 70 |
65 } // namespace | 71 } // namespace |
66 | 72 |
67 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } | 73 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } |
68 | 74 |
69 } // namespace ui | 75 } // namespace ui |
OLD | NEW |