OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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_PUBLIC_OZONE_PLATFORM_H_ |
| 6 #define UI_OZONE_PUBLIC_OZONE_PLATFORM_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/ozone/ozone_export.h" |
| 10 |
| 11 namespace gfx { |
| 12 class Rect; |
| 13 } |
| 14 |
| 15 namespace ui { |
| 16 |
| 17 class CursorFactoryOzone; |
| 18 class InputController; |
| 19 class GpuPlatformSupport; |
| 20 class GpuPlatformSupportHost; |
| 21 class NativeDisplayDelegate; |
| 22 class OverlayManagerOzone; |
| 23 class PlatformWindow; |
| 24 class PlatformWindowDelegate; |
| 25 class SurfaceFactoryOzone; |
| 26 class SystemInputInjector; |
| 27 |
| 28 // Base class for Ozone platform implementations. |
| 29 // |
| 30 // Ozone platforms must override this class and implement the virtual |
| 31 // GetFooFactoryOzone() methods to provide implementations of the |
| 32 // various ozone interfaces. |
| 33 // |
| 34 // The OzonePlatform subclass can own any state needed by the |
| 35 // implementation that is shared between the various ozone interfaces, |
| 36 // such as a connection to the windowing system. |
| 37 // |
| 38 // A platform is free to use different implementations of each |
| 39 // interface depending on the context. You can, for example, create |
| 40 // different objects depending on the underlying hardware, command |
| 41 // line flags, or whatever is appropriate for the platform. |
| 42 class OZONE_EXPORT OzonePlatform { |
| 43 public: |
| 44 OzonePlatform(); |
| 45 virtual ~OzonePlatform(); |
| 46 |
| 47 // Initializes the subsystems/resources necessary for the UI process (e.g. |
| 48 // events, surface, etc.) |
| 49 static void InitializeForUI(); |
| 50 |
| 51 // Initializes the subsystems/resources necessary for the GPU process. |
| 52 static void InitializeForGPU(); |
| 53 |
| 54 static OzonePlatform* GetInstance(); |
| 55 |
| 56 // Factory getters to override in subclasses. The returned objects will be |
| 57 // injected into the appropriate layer at startup. Subclasses should not |
| 58 // inject these objects themselves. Ownership is retained by OzonePlatform. |
| 59 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0; |
| 60 virtual ui::OverlayManagerOzone* GetOverlayManager() = 0; |
| 61 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0; |
| 62 virtual ui::InputController* GetInputController() = 0; |
| 63 virtual ui::GpuPlatformSupport* GetGpuPlatformSupport() = 0; |
| 64 virtual ui::GpuPlatformSupportHost* GetGpuPlatformSupportHost() = 0; |
| 65 virtual scoped_ptr<SystemInputInjector> CreateSystemInputInjector() = 0; |
| 66 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 67 PlatformWindowDelegate* delegate, |
| 68 const gfx::Rect& bounds) = 0; |
| 69 virtual scoped_ptr<ui::NativeDisplayDelegate> |
| 70 CreateNativeDisplayDelegate() = 0; |
| 71 |
| 72 private: |
| 73 virtual void InitializeUI() = 0; |
| 74 virtual void InitializeGPU() = 0; |
| 75 |
| 76 static void CreateInstance(); |
| 77 |
| 78 static OzonePlatform* instance_; |
| 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(OzonePlatform); |
| 81 }; |
| 82 |
| 83 } // namespace ui |
| 84 |
| 85 #endif // UI_OZONE_PUBLIC_OZONE_PLATFORM_H_ |
OLD | NEW |