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