1 // Copyright 2013 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_OZONE_PLATFORM_H_
6 #define UI_OZONE_OZONE_PLATFORM_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "ui/ozone/ozone_export.h"
12 class SurfaceFactoryOzone
;
17 class CursorFactoryOzone
;
18 class EventFactoryOzone
;
19 class NativeDisplayDelegate
;
20 class TouchscreenDeviceManager
;
22 // Base class for Ozone platform implementations.
24 // Ozone platforms must override this class and implement the virtual
25 // GetFooFactoryOzone() methods to provide implementations of the
26 // various ozone interfaces.
28 // The OzonePlatform subclass can own any state needed by the
29 // implementation that is shared between the various ozone interfaces,
30 // such as a connection to the windowing system.
32 // A platform is free to use different implementations of each
33 // interface depending on the context. You can, for example, create
34 // different objects depending on the underlying hardware, command
35 // line flags, or whatever is appropriate for the platform.
36 class OZONE_EXPORT OzonePlatform
{
39 virtual ~OzonePlatform();
41 // Initializes the subsystems/resources necessary for the UI process (e.g.
42 // events, surface, etc.)
43 static void InitializeForUI();
45 // Initializes the subsystems/resources necessary for the GPU process.
46 static void InitializeForGPU();
48 static OzonePlatform
* GetInstance();
50 // Factory getters to override in subclasses. The returned objects will be
51 // injected into the appropriate layer at startup. Subclasses should not
52 // inject these objects themselves. Ownership is retained by OzonePlatform.
53 virtual gfx::SurfaceFactoryOzone
* GetSurfaceFactoryOzone() = 0;
54 virtual ui::EventFactoryOzone
* GetEventFactoryOzone() = 0;
55 virtual ui::CursorFactoryOzone
* GetCursorFactoryOzone() = 0;
56 #if defined(OS_CHROMEOS)
57 virtual scoped_ptr
<ui::NativeDisplayDelegate
>
58 CreateNativeDisplayDelegate() = 0;
59 virtual scoped_ptr
<ui::TouchscreenDeviceManager
>
60 CreateTouchscreenDeviceManager() = 0;
64 virtual void InitializeUI() = 0;
65 virtual void InitializeGPU() = 0;
67 static void CreateInstance();
69 static OzonePlatform
* instance_
;
71 DISALLOW_COPY_AND_ASSIGN(OzonePlatform
);
76 #endif // UI_OZONE_OZONE_PLATFORM_H_