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