chrome/browser/extensions: Remove use of MessageLoopProxy and deprecated MessageLoop...
[chromium-blink-merge.git] / ui / ozone / public / ozone_platform.h
blob590104b8428a8145afcb8c0f8da5a4a2e95ed591
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"
11 namespace gfx {
12 class Rect;
15 namespace ui {
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;
28 // Base class for Ozone platform implementations.
30 // Ozone platforms must override this class and implement the virtual
31 // GetFooFactoryOzone() methods to provide implementations of the
32 // various ozone interfaces.
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.
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();
47 // Initializes the subsystems/resources necessary for the UI process (e.g.
48 // events, surface, etc.)
49 static void InitializeForUI();
51 // Initializes the subsystems/resources necessary for the GPU process.
52 static void InitializeForGPU();
54 static OzonePlatform* GetInstance();
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;
72 private:
73 virtual void InitializeUI() = 0;
74 virtual void InitializeGPU() = 0;
76 static void CreateInstance();
78 static OzonePlatform* instance_;
80 DISALLOW_COPY_AND_ASSIGN(OzonePlatform);
83 } // namespace ui
85 #endif // UI_OZONE_PUBLIC_OZONE_PLATFORM_H_