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