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/window/platform_window_compat.h" | |
8 #include "ui/ozone/platform/caca/caca_connection.h" | |
9 #include "ui/ozone/platform/caca/caca_event_factory.h" | 7 #include "ui/ozone/platform/caca/caca_event_factory.h" |
10 #include "ui/ozone/platform/caca/caca_surface_factory.h" | 8 #include "ui/ozone/platform/caca/caca_window.h" |
| 9 #include "ui/ozone/platform/caca/caca_window_manager.h" |
11 #include "ui/ozone/public/cursor_factory_ozone.h" | 10 #include "ui/ozone/public/cursor_factory_ozone.h" |
12 #include "ui/ozone/public/ozone_platform.h" | 11 #include "ui/ozone/public/ozone_platform.h" |
13 | 12 |
14 #if defined(OS_CHROMEOS) | 13 #if defined(OS_CHROMEOS) |
15 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" | 14 #include "ui/ozone/common/chromeos/native_display_delegate_ozone.h" |
16 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" | 15 #include "ui/ozone/common/chromeos/touchscreen_device_manager_ozone.h" |
17 #endif | 16 #endif |
18 | 17 |
19 namespace ui { | 18 namespace ui { |
20 | 19 |
21 namespace { | 20 namespace { |
22 | 21 |
23 class OzonePlatformCaca : public OzonePlatform { | 22 class OzonePlatformCaca : public OzonePlatform { |
24 public: | 23 public: |
25 OzonePlatformCaca() {} | 24 OzonePlatformCaca() {} |
26 virtual ~OzonePlatformCaca() {} | 25 virtual ~OzonePlatformCaca() {} |
27 | 26 |
28 // OzonePlatform: | 27 // OzonePlatform: |
29 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { | 28 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { |
30 return surface_factory_ozone_.get(); | 29 return window_manager_.get(); |
31 } | 30 } |
32 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { | 31 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { |
33 return event_factory_ozone_.get(); | 32 return event_factory_ozone_.get(); |
34 } | 33 } |
35 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { | 34 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { |
36 return cursor_factory_ozone_.get(); | 35 return cursor_factory_ozone_.get(); |
37 } | 36 } |
38 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { | 37 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { |
39 return NULL; // no GPU support | 38 return NULL; // no GPU support |
40 } | 39 } |
41 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { | 40 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { |
42 return NULL; // no GPU support | 41 return NULL; // no GPU support |
43 } | 42 } |
44 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( | 43 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( |
45 PlatformWindowDelegate* delegate, | 44 PlatformWindowDelegate* delegate, |
46 const gfx::Rect& bounds) OVERRIDE { | 45 const gfx::Rect& bounds) OVERRIDE { |
47 return make_scoped_ptr<PlatformWindow>( | 46 scoped_ptr<CacaWindow> caca_window(new CacaWindow( |
48 new PlatformWindowCompat(delegate, bounds)); | 47 delegate, window_manager_.get(), event_factory_ozone_.get(), bounds)); |
| 48 if (!caca_window->Initialize()) |
| 49 return scoped_ptr<PlatformWindow>(); |
| 50 return caca_window.PassAs<PlatformWindow>(); |
49 } | 51 } |
50 | 52 |
51 #if defined(OS_CHROMEOS) | 53 #if defined(OS_CHROMEOS) |
52 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 54 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
53 OVERRIDE { | 55 OVERRIDE { |
54 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 56 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
55 } | 57 } |
56 virtual scoped_ptr<TouchscreenDeviceManager> | 58 virtual scoped_ptr<TouchscreenDeviceManager> |
57 CreateTouchscreenDeviceManager() OVERRIDE { | 59 CreateTouchscreenDeviceManager() OVERRIDE { |
58 return scoped_ptr<TouchscreenDeviceManager>( | 60 return scoped_ptr<TouchscreenDeviceManager>( |
59 new TouchscreenDeviceManagerOzone()); | 61 new TouchscreenDeviceManagerOzone()); |
60 } | 62 } |
61 #endif | 63 #endif |
62 | 64 |
63 virtual void InitializeUI() OVERRIDE { | 65 virtual void InitializeUI() OVERRIDE { |
64 surface_factory_ozone_.reset(new CacaSurfaceFactory(&connection_)); | 66 window_manager_.reset(new CacaWindowManager); |
65 event_factory_ozone_.reset(new CacaEventFactory(&connection_)); | 67 event_factory_ozone_.reset(new CacaEventFactory()); |
66 cursor_factory_ozone_.reset(new CursorFactoryOzone()); | 68 cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
67 } | 69 } |
68 | 70 |
69 virtual void InitializeGPU() OVERRIDE {} | 71 virtual void InitializeGPU() OVERRIDE {} |
70 | 72 |
71 private: | 73 private: |
72 CacaConnection connection_; | 74 scoped_ptr<CacaWindowManager> window_manager_; |
73 scoped_ptr<CacaSurfaceFactory> surface_factory_ozone_; | |
74 scoped_ptr<CacaEventFactory> event_factory_ozone_; | 75 scoped_ptr<CacaEventFactory> event_factory_ozone_; |
75 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; | 76 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
76 | 77 |
77 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); | 78 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); |
78 }; | 79 }; |
79 | 80 |
80 } // namespace | 81 } // namespace |
81 | 82 |
82 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } | 83 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } |
83 | 84 |
84 } // namespace ui | 85 } // namespace ui |
OLD | NEW |