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