Index: ui/ozone/public/ozone_client.h |
diff --git a/ui/ozone/public/ozone_client.h b/ui/ozone/public/ozone_client.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..37dd173e285d001708e0e2f1e2b7b3610563bb23 |
--- /dev/null |
+++ b/ui/ozone/public/ozone_client.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2015 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_PUBLIC_OZONE_CLIENT_H_ |
+#define UI_OZONE_PUBLIC_OZONE_CLIENT_H_ |
+ |
+#include "ui/ozone/ozone_export.h" |
+ |
+namespace ui { |
+ |
+class SurfaceClientFactoryOzone; |
+ |
+// Base class for Ozone client implementations. Render process and UI process |
+// use OzoneClient instead of OzonePlatform to access Ozone specific |
+// features. e.g. share a surface created by GPU process |
+// |
+// UI process uses both OzoneClient and OzonePlatform but the purpose is |
+// different. UI process initializes subsystems (e.g. events, surface) via |
+// OzonePlatform, while OzoneClient is used for ozone client purpose. |
+// (e.g. surface sharing) |
+// |
+// Each Ozone platforms override this class and implement the virtual |
+// GetFooFactoryOzone() methods to provide implementations of the |
+// various ozone interfaces. |
+// |
+// 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 OzoneClient { |
+ public: |
+ OzoneClient(); |
+ virtual ~OzoneClient(); |
+ |
+ // Initializes the resources necessary for the UI process. |
+ static void InitializeForUI(); |
+ |
+ // Initializes the resources necessary for the Render process. |
+ static void InitializeForRenderer(); |
spang
2015/06/01 22:46:41
Why are these functions separate but do the same t
dshwang
2015/06/03 14:11:51
Sure, I comments future plan in NativePixmapClient
|
+ |
+ static OzoneClient* GetInstance(); |
+ |
+ // 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 OzoneClient. |
+ virtual SurfaceClientFactoryOzone* GetSurfaceClientFactoryOzone() = 0; |
+ |
+ private: |
+ virtual void InitializeUI() = 0; |
+ virtual void InitializeRenderer() = 0; |
+ |
+ static void CreateInstance(); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(OzoneClient); |
+}; |
+ |
+} // namespace ui |
+ |
+#endif // UI_OZONE_PUBLIC_OZONE_CLIENT_H_ |