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