OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef UI_OZONE_OZONE_PLATFORM_H_ | 5 #ifndef UI_OZONE_OZONE_PLATFORM_H_ |
6 #define UI_OZONE_OZONE_PLATFORM_H_ | 6 #define UI_OZONE_OZONE_PLATFORM_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/events/ozone/event_factory_ozone.h" | 9 #include "ui/events/ozone/event_factory_ozone.h" |
10 #include "ui/gfx/ozone/surface_factory_ozone.h" | 10 #include "ui/gfx/ozone/surface_factory_ozone.h" |
11 #include "ui/ozone/ime/input_method_context_factory_ozone.h" | 11 #include "ui/ozone/ime/input_method_context_factory_ozone.h" |
12 #include "ui/ozone/ozone_export.h" | 12 #include "ui/ozone/ozone_export.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 | 15 |
16 class CursorFactoryOzone; | 16 class CursorFactoryOzone; |
| 17 class NativeDisplayDelegate; |
17 | 18 |
18 // Base class for Ozone platform implementations. | 19 // Base class for Ozone platform implementations. |
19 // | 20 // |
20 // Ozone platforms must override this class and implement the virtual | 21 // Ozone platforms must override this class and implement the virtual |
21 // GetFooFactoryOzone() methods to provide implementations of the | 22 // GetFooFactoryOzone() methods to provide implementations of the |
22 // various ozone interfaces. | 23 // various ozone interfaces. |
23 // | 24 // |
24 // The OzonePlatform subclass can own any state needed by the | 25 // The OzonePlatform subclass can own any state needed by the |
25 // implementation that is shared between the various ozone interfaces, | 26 // implementation that is shared between the various ozone interfaces, |
26 // such as a connection to the windowing system. | 27 // such as a connection to the windowing system. |
27 // | 28 // |
28 // A platform is free to use different implementations of each | 29 // A platform is free to use different implementations of each |
29 // interface depending on the context. You can, for example, create | 30 // interface depending on the context. You can, for example, create |
30 // different objects depending on the underlying hardware, command | 31 // different objects depending on the underlying hardware, command |
31 // line flags, or whatever is appropriate for the platform. | 32 // line flags, or whatever is appropriate for the platform. |
32 class OZONE_EXPORT OzonePlatform { | 33 class OZONE_EXPORT OzonePlatform { |
33 public: | 34 public: |
34 OzonePlatform(); | 35 OzonePlatform(); |
35 virtual ~OzonePlatform(); | 36 virtual ~OzonePlatform(); |
36 | 37 |
37 // Initialize the platform. Once complete, SurfaceFactoryOzone & | 38 // Initialize the platform. Once complete, SurfaceFactoryOzone & |
38 // EventFactoryOzone will be set. | 39 // EventFactoryOzone will be set. |
39 static void Initialize(); | 40 static void Initialize(); |
40 | 41 |
| 42 static OzonePlatform* GetInstance(); |
| 43 |
41 // Factory getters to override in subclasses. The returned objects will be | 44 // Factory getters to override in subclasses. The returned objects will be |
42 // injected into the appropriate layer at startup. Subclasses should not | 45 // injected into the appropriate layer at startup. Subclasses should not |
43 // inject these objects themselves. Ownership is retained by OzonePlatform. | 46 // inject these objects themselves. Ownership is retained by OzonePlatform. |
44 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0; | 47 virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0; |
45 virtual ui::EventFactoryOzone* GetEventFactoryOzone() = 0; | 48 virtual ui::EventFactoryOzone* GetEventFactoryOzone() = 0; |
46 virtual ui::InputMethodContextFactoryOzone* | 49 virtual ui::InputMethodContextFactoryOzone* |
47 GetInputMethodContextFactoryOzone() = 0; | 50 GetInputMethodContextFactoryOzone() = 0; |
48 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0; | 51 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0; |
| 52 #if defined(OS_CHROMEOS) |
| 53 virtual scoped_ptr<ui::NativeDisplayDelegate> |
| 54 CreateNativeDisplayDelegate() = 0; |
| 55 #endif |
49 | 56 |
50 private: | 57 private: |
51 static OzonePlatform* instance_; | 58 static OzonePlatform* instance_; |
52 | 59 |
53 DISALLOW_COPY_AND_ASSIGN(OzonePlatform); | 60 DISALLOW_COPY_AND_ASSIGN(OzonePlatform); |
54 }; | 61 }; |
55 | 62 |
56 } // namespace ui | 63 } // namespace ui |
57 | 64 |
58 #endif // UI_OZONE_OZONE_PLATFORM_H_ | 65 #endif // UI_OZONE_OZONE_PLATFORM_H_ |
OLD | NEW |