| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 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. | |
| 4 | |
| 5 #ifndef UI_OZONE_OZONE_PLATFORM_H_ | |
| 6 #define UI_OZONE_OZONE_PLATFORM_H_ | |
| 7 | |
| 8 #include "base/memory/scoped_ptr.h" | |
| 9 #include "ui/ozone/ozone_export.h" | |
| 10 | |
| 11 namespace ui { | |
| 12 | |
| 13 class CursorFactoryOzone; | |
| 14 class EventFactoryOzone; | |
| 15 class NativeDisplayDelegate; | |
| 16 class SurfaceFactoryOzone; | |
| 17 class TouchscreenDeviceManager; | |
| 18 class GpuPlatformSupport; | |
| 19 class GpuPlatformSupportHost; | |
| 20 | |
| 21 // Base class for Ozone platform implementations. | |
| 22 // | |
| 23 // Ozone platforms must override this class and implement the virtual | |
| 24 // GetFooFactoryOzone() methods to provide implementations of the | |
| 25 // various ozone interfaces. | |
| 26 // | |
| 27 // The OzonePlatform subclass can own any state needed by the | |
| 28 // implementation that is shared between the various ozone interfaces, | |
| 29 // such as a connection to the windowing system. | |
| 30 // | |
| 31 // A platform is free to use different implementations of each | |
| 32 // interface depending on the context. You can, for example, create | |
| 33 // different objects depending on the underlying hardware, command | |
| 34 // line flags, or whatever is appropriate for the platform. | |
| 35 class OZONE_EXPORT OzonePlatform { | |
| 36 public: | |
| 37 OzonePlatform(); | |
| 38 virtual ~OzonePlatform(); | |
| 39 | |
| 40 // Initializes the subsystems/resources necessary for the UI process (e.g. | |
| 41 // events, surface, etc.) | |
| 42 static void InitializeForUI(); | |
| 43 | |
| 44 // Initializes the subsystems/resources necessary for the GPU process. | |
| 45 static void InitializeForGPU(); | |
| 46 | |
| 47 static OzonePlatform* GetInstance(); | |
| 48 | |
| 49 // Factory getters to override in subclasses. The returned objects will be | |
| 50 // injected into the appropriate layer at startup. Subclasses should not | |
| 51 // inject these objects themselves. Ownership is retained by OzonePlatform. | |
| 52 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() = 0; | |
| 53 virtual ui::EventFactoryOzone* GetEventFactoryOzone() = 0; | |
| 54 virtual ui::CursorFactoryOzone* GetCursorFactoryOzone() = 0; | |
| 55 virtual ui::GpuPlatformSupport* GetGpuPlatformSupport() = 0; | |
| 56 virtual ui::GpuPlatformSupportHost* GetGpuPlatformSupportHost() = 0; | |
| 57 #if defined(OS_CHROMEOS) | |
| 58 virtual scoped_ptr<ui::NativeDisplayDelegate> | |
| 59 CreateNativeDisplayDelegate() = 0; | |
| 60 virtual scoped_ptr<ui::TouchscreenDeviceManager> | |
| 61 CreateTouchscreenDeviceManager() = 0; | |
| 62 #endif | |
| 63 | |
| 64 private: | |
| 65 virtual void InitializeUI() = 0; | |
| 66 virtual void InitializeGPU() = 0; | |
| 67 | |
| 68 static void CreateInstance(); | |
| 69 | |
| 70 static OzonePlatform* instance_; | |
| 71 | |
| 72 DISALLOW_COPY_AND_ASSIGN(OzonePlatform); | |
| 73 }; | |
| 74 | |
| 75 } // namespace ui | |
| 76 | |
| 77 #endif // UI_OZONE_OZONE_PLATFORM_H_ | |
| OLD | NEW |