Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(745)

Unified Diff: ui/ozone/ozone_platform.h

Issue 44933002: Implement OzonePlatform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/ozone/ozone_export.h ('k') | ui/ozone/ozone_platform.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/ozone_platform.h
diff --git a/ui/ozone/ozone_platform.h b/ui/ozone/ozone_platform.h
new file mode 100644
index 0000000000000000000000000000000000000000..c7657c61feb316560399fa01aa2c72bf6ff126c0
--- /dev/null
+++ b/ui/ozone/ozone_platform.h
@@ -0,0 +1,55 @@
+// 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_OZONE_OZONE_PLATFORM_H_
+#define UI_OZONE_OZONE_PLATFORM_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "ui/events/ozone/event_factory_ozone.h"
+#include "ui/gfx/ozone/surface_factory_ozone.h"
+#include "ui/ozone/ozone_export.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();
+
+ // Initialize the platform. Once complete, SurfaceFactoryOzone &
+ // EventFactoryOzone will be set.
+ static void Initialize();
+
+ // Factory getters to override in subclasses. The returned objects will be
+ // injected into the appropriate layer at startup. Subclasses should not
+ // inject these objects themselves. Ownership is retained by OzonePlatform.
+ 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_
« no previous file with comments | « ui/ozone/ozone_export.h ('k') | ui/ozone/ozone_platform.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698