Index: ui/base/ozone/ozone_platform.h |
diff --git a/ui/base/ozone/ozone_platform.h b/ui/base/ozone/ozone_platform.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..467d8f93a7c15e68719a8ca8e421cb20bba9b5c9 |
--- /dev/null |
+++ b/ui/base/ozone/ozone_platform.h |
@@ -0,0 +1,54 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_EVENTS_OZONE_OZONE_PLATFORM_H_ |
+#define UI_EVENTS_OZONE_OZONE_PLATFORM_H_ |
+ |
+#include "base/memory/scoped_ptr.h" |
+#include "ui/base/ozone/ozone_export.h" |
+#include "ui/events/ozone/event_factory_ozone.h" |
+#include "ui/gfx/ozone/surface_factory_ozone.h" |
+ |
+namespace ui { |
+ |
+// Base class for Ozone platform implementations. |
+// |
+// Ozone platforms must override this class and implement the virtual |
+// GetFooFactoryOzone() methods to provide implementations of the |
+// various ozone interfaces. |
+// |
+// The OzonePlatform subclass can own any state needed by the |
+// implementation that is shared between the various ozone interfaces, |
+// such as a connection to the windowing system. |
+// |
+// A platform is free to use different implementations of each |
+// interface depending on the context. You can, for example, create |
+// different objects depending on the underlying hardware, command |
+// line flags, or whatever is appropriate for the platform. |
+class OZONE_EXPORT OzonePlatform { |
+ public: |
+ OzonePlatform(); |
+ virtual ~OzonePlatform(); |
+ |
+ // Build an OzonePlatform object. This is usually called by the |
+ // content layer to initialize ozone. The caller receives ownership. |
+ static OzonePlatform* Create(); |
+ |
+ // Factory getters to override in subclasses. The returned objects |
+ // will be injected into the appropriate layer at startup. |
+ virtual gfx::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0; |
+ virtual ui::EventFactoryOzone* GetEventFactoryOzone() = 0; |
+ |
+ private: |
+ static OzonePlatform* instance_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(OzonePlatform); |
+}; |
+ |
+// Hook to be provided by the built-in default implementation. |
+OzonePlatform* CreateDefaultOzonePlatform(); |
+ |
+} // namespace ui |
+ |
+#endif // UI_OZONE_OZONE_PLATFORM_H_ |