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/base/cursor/ozone/cursor_factory_ozone.h" | 7 #include "ui/base/cursor/ozone/cursor_factory_ozone.h" |
8 #include "ui/ozone/ime/input_method_context_factory_ozone.h" | |
9 #include "ui/ozone/ozone_platform.h" | 8 #include "ui/ozone/ozone_platform.h" |
10 #include "ui/ozone/platform/caca/caca_connection.h" | 9 #include "ui/ozone/platform/caca/caca_connection.h" |
11 #include "ui/ozone/platform/caca/caca_event_factory.h" | 10 #include "ui/ozone/platform/caca/caca_event_factory.h" |
12 #include "ui/ozone/platform/caca/caca_surface_factory.h" | 11 #include "ui/ozone/platform/caca/caca_surface_factory.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 #endif | 15 #endif |
17 | 16 |
18 namespace ui { | 17 namespace ui { |
19 | 18 |
20 namespace { | 19 namespace { |
21 | 20 |
22 class OzonePlatformCaca : public OzonePlatform { | 21 class OzonePlatformCaca : public OzonePlatform { |
23 public: | 22 public: |
24 OzonePlatformCaca() {} | 23 OzonePlatformCaca() {} |
25 virtual ~OzonePlatformCaca() {} | 24 virtual ~OzonePlatformCaca() {} |
26 | 25 |
27 // OzonePlatform: | 26 // OzonePlatform: |
28 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { | 27 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { |
29 return surface_factory_ozone_.get(); | 28 return surface_factory_ozone_.get(); |
30 } | 29 } |
31 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { | 30 virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE { |
32 return event_factory_ozone_.get(); | 31 return event_factory_ozone_.get(); |
33 } | 32 } |
34 virtual InputMethodContextFactoryOzone* GetInputMethodContextFactoryOzone() | |
35 OVERRIDE { | |
36 return input_method_context_factory_ozone_.get(); | |
37 } | |
38 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { | 33 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { |
39 return cursor_factory_ozone_.get(); | 34 return cursor_factory_ozone_.get(); |
40 } | 35 } |
41 | 36 |
42 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
43 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 38 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
44 OVERRIDE { | 39 OVERRIDE { |
45 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); | 40 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone()); |
46 } | 41 } |
47 #endif | 42 #endif |
48 | 43 |
49 virtual void InitializeUI() OVERRIDE { | 44 virtual void InitializeUI() OVERRIDE { |
50 surface_factory_ozone_.reset(new CacaSurfaceFactory(&connection_)); | 45 surface_factory_ozone_.reset(new CacaSurfaceFactory(&connection_)); |
51 event_factory_ozone_.reset(new CacaEventFactory(&connection_)); | 46 event_factory_ozone_.reset(new CacaEventFactory(&connection_)); |
52 input_method_context_factory_ozone_.reset( | |
53 new InputMethodContextFactoryOzone()); | |
54 cursor_factory_ozone_.reset(new CursorFactoryOzone()); | 47 cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
55 } | 48 } |
56 | 49 |
57 virtual void InitializeGPU() OVERRIDE {} | 50 virtual void InitializeGPU() OVERRIDE {} |
58 | 51 |
59 private: | 52 private: |
60 CacaConnection connection_; | 53 CacaConnection connection_; |
61 scoped_ptr<CacaSurfaceFactory> surface_factory_ozone_; | 54 scoped_ptr<CacaSurfaceFactory> surface_factory_ozone_; |
62 scoped_ptr<CacaEventFactory> event_factory_ozone_; | 55 scoped_ptr<CacaEventFactory> event_factory_ozone_; |
63 // This creates a minimal input context. | |
64 scoped_ptr<InputMethodContextFactoryOzone> | |
65 input_method_context_factory_ozone_; | |
66 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; | 56 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
67 | 57 |
68 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); | 58 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); |
69 }; | 59 }; |
70 | 60 |
71 } // namespace | 61 } // namespace |
72 | 62 |
73 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } | 63 OzonePlatform* CreateOzonePlatformCaca() { return new OzonePlatformCaca; } |
74 | 64 |
75 } // namespace ui | 65 } // namespace ui |
OLD | NEW |