blob: 590104b8428a8145afcb8c0f8da5a4a2e95ed591 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
// Copyright 2014 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_PLATFORM_H_
#define UI_OZONE_PUBLIC_OZONE_PLATFORM_H_
#include "base/memory/scoped_ptr.h"
#include "ui/ozone/ozone_export.h"
namespace gfx {
class Rect;
}
namespace ui {
class CursorFactoryOzone;
class InputController;
class GpuPlatformSupport;
class GpuPlatformSupportHost;
class NativeDisplayDelegate;
class OverlayManagerOzone;
class PlatformWindow;
class PlatformWindowDelegate;
class SurfaceFactoryOzone;
class SystemInputInjector;
// 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();
// Initializes the subsystems/resources necessary for the UI process (e.g.
// events, surface, etc.)
static void InitializeForUI();
// Initializes the subsystems/resources necessary for the GPU process.
static void InitializeForGPU();
static OzonePlatform* 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 OzonePlatform.
virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0;
virtual ui::OverlayManagerOzone* GetOverlayManager() = 0;
virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0;
virtual ui::InputController* GetInputController() = 0;
virtual ui::GpuPlatformSupport* GetGpuPlatformSupport() = 0;
virtual ui::GpuPlatformSupportHost* GetGpuPlatformSupportHost() = 0;
virtual scoped_ptr<SystemInputInjector> CreateSystemInputInjector() = 0;
virtual scoped_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
const gfx::Rect& bounds) = 0;
virtual scoped_ptr<ui::NativeDisplayDelegate>
CreateNativeDisplayDelegate() = 0;
private:
virtual void InitializeUI() = 0;
virtual void InitializeGPU() = 0;
static void CreateInstance();
static OzonePlatform* instance_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatform);
};
} // namespace ui
#endif // UI_OZONE_PUBLIC_OZONE_PLATFORM_H_
|