Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / ozone / public / ozone_platform.h
bloba2837749b8bcf615bb4f855ec34122f9fd68e62d
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 NativeDisplayDelegate;
19 class SurfaceFactoryOzone;
20 class TouchscreenDeviceManager;
21 class GpuPlatformSupport;
22 class GpuPlatformSupportHost;
23 class PlatformWindow;
24 class PlatformWindowDelegate;
26 // Base class for Ozone platform implementations.
28 // Ozone platforms must override this class and implement the virtual
29 // GetFooFactoryOzone() methods to provide implementations of the
30 // various ozone interfaces.
32 // The OzonePlatform subclass can own any state needed by the
33 // implementation that is shared between the various ozone interfaces,
34 // such as a connection to the windowing system.
36 // A platform is free to use different implementations of each
37 // interface depending on the context. You can, for example, create
38 // different objects depending on the underlying hardware, command
39 // line flags, or whatever is appropriate for the platform.
40 class OZONE_EXPORT OzonePlatform {
41 public:
42 OzonePlatform();
43 virtual ~OzonePlatform();
45 // Initializes the subsystems/resources necessary for the UI process (e.g.
46 // events, surface, etc.)
47 static void InitializeForUI();
49 // Initializes the subsystems/resources necessary for the GPU process.
50 static void InitializeForGPU();
52 static OzonePlatform* GetInstance();
54 // Factory getters to override in subclasses. The returned objects will be
55 // injected into the appropriate layer at startup. Subclasses should not
56 // inject these objects themselves. Ownership is retained by OzonePlatform.
57 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0;
58 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0;
59 virtual ui::GpuPlatformSupport* GetGpuPlatformSupport() = 0;
60 virtual ui::GpuPlatformSupportHost* GetGpuPlatformSupportHost() = 0;
61 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow(
62 PlatformWindowDelegate* delegate,
63 const gfx::Rect& bounds) = 0;
64 #if defined(OS_CHROMEOS)
65 virtual scoped_ptr<ui::NativeDisplayDelegate>
66 CreateNativeDisplayDelegate() = 0;
67 virtual scoped_ptr<ui::TouchscreenDeviceManager>
68 CreateTouchscreenDeviceManager() = 0;
69 #endif
71 private:
72 virtual void InitializeUI() = 0;
73 virtual void InitializeGPU() = 0;
75 static void CreateInstance();
77 static OzonePlatform* instance_;
79 DISALLOW_COPY_AND_ASSIGN(OzonePlatform);
82 } // namespace ui
84 #endif // UI_OZONE_PUBLIC_OZONE_PLATFORM_H_