Fix OOP <webview> resize and autosize.
[chromium-blink-merge.git] / ui / ozone / public / ozone_platform.h
blobe4a7bca45fc37d8d70be6208c04eb76ebdd9ae92
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/files/scoped_file.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/ozone/ozone_export.h"
12 namespace gfx {
13 class Rect;
16 namespace ui {
18 class CursorFactoryOzone;
19 class InputController;
20 class GpuPlatformSupport;
21 class GpuPlatformSupportHost;
22 class NativeDisplayDelegate;
23 class OverlayManagerOzone;
24 class PlatformWindow;
25 class PlatformWindowDelegate;
26 class SurfaceFactoryOzone;
27 class SystemInputInjector;
29 // Base class for Ozone platform implementations.
31 // Ozone platforms must override this class and implement the virtual
32 // GetFooFactoryOzone() methods to provide implementations of the
33 // various ozone interfaces.
35 // The OzonePlatform subclass can own any state needed by the
36 // implementation that is shared between the various ozone interfaces,
37 // such as a connection to the windowing system.
39 // A platform is free to use different implementations of each
40 // interface depending on the context. You can, for example, create
41 // different objects depending on the underlying hardware, command
42 // line flags, or whatever is appropriate for the platform.
43 class OZONE_EXPORT OzonePlatform {
44 public:
45 OzonePlatform();
46 virtual ~OzonePlatform();
48 // Initializes the subsystems/resources necessary for the UI process (e.g.
49 // events, surface, etc.)
50 static void InitializeForUI();
52 // Initializes the subsystems/resources necessary for the GPU process.
53 static void InitializeForGPU();
55 static OzonePlatform* GetInstance();
57 // Factory getters to override in subclasses. The returned objects will be
58 // injected into the appropriate layer at startup. Subclasses should not
59 // inject these objects themselves. Ownership is retained by OzonePlatform.
60 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0;
61 virtual ui::OverlayManagerOzone* GetOverlayManager() = 0;
62 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0;
63 virtual ui::InputController* GetInputController() = 0;
64 virtual ui::GpuPlatformSupport* GetGpuPlatformSupport() = 0;
65 virtual ui::GpuPlatformSupportHost* GetGpuPlatformSupportHost() = 0;
66 virtual scoped_ptr<SystemInputInjector> CreateSystemInputInjector() = 0;
67 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow(
68 PlatformWindowDelegate* delegate,
69 const gfx::Rect& bounds) = 0;
70 virtual scoped_ptr<ui::NativeDisplayDelegate>
71 CreateNativeDisplayDelegate() = 0;
72 // Open ClientNativePixmap device file for non-GPU processes to import a
73 // ClientNativePixmap.
74 virtual base::ScopedFD OpenClientNativePixmapDevice() const = 0;
76 private:
77 virtual void InitializeUI() = 0;
78 virtual void InitializeGPU() = 0;
80 static void CreateInstance();
82 static OzonePlatform* instance_;
84 DISALLOW_COPY_AND_ASSIGN(OzonePlatform);
87 } // namespace ui
89 #endif // UI_OZONE_PUBLIC_OZONE_PLATFORM_H_