Update UnusedResources lint suppressions.
[chromium-blink-merge.git] / ui / ozone / platform / cast / surface_factory_cast.h
blobc996187f1f1ade02be87b6961e21be9b44d53ef2
1 // Copyright 2015 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_PLATFORM_CAST_SURFACE_FACTORY_CAST_H_
6 #define UI_OZONE_PLATFORM_CAST_SURFACE_FACTORY_CAST_H_
8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/ozone/public/surface_factory_ozone.h"
13 namespace chromecast {
14 class CastEglPlatform;
17 namespace ui {
19 // SurfaceFactoryOzone implementation for OzonePlatformCast.
20 class SurfaceFactoryCast : public SurfaceFactoryOzone {
21 public:
22 explicit SurfaceFactoryCast(
23 scoped_ptr<chromecast::CastEglPlatform> egl_platform);
24 ~SurfaceFactoryCast() override;
26 // SurfaceFactoryOzone implementation:
27 intptr_t GetNativeDisplay() override;
28 scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget(
29 gfx::AcceleratedWidget widget) override;
30 const int32* GetEGLSurfaceProperties(const int32* desired_list) override;
31 scoped_refptr<NativePixmap> CreateNativePixmap(gfx::AcceleratedWidget w,
32 gfx::Size size,
33 BufferFormat format,
34 BufferUsage usage) override;
35 bool LoadEGLGLES2Bindings(
36 AddGLLibraryCallback add_gl_library,
37 SetGLGetProcAddressProcCallback set_gl_get_proc_address) override;
39 void SetToRelinquishDisplay(const base::Closure& callback);
40 intptr_t GetNativeWindow();
41 bool ResizeDisplay(gfx::Size viewport_size);
42 void ChildDestroyed();
43 void SendRelinquishResponse();
45 private:
46 enum HardwareState { kUninitialized, kInitialized, kFailed };
48 // Window is destroyed if both SetToDestroyEGLDisplay()
49 // and destructor are called (in either order) before the next
50 // SurfaceOzoneEglCast is created in order to preserve the
51 // window across surface creation whenever possible.
52 enum DestroyWindowPendingState {
53 kNoDestroyPending = 0, // Surface does not exist
54 kSurfaceExists, // surface and window both exist
55 kWindowDestroyPending, // Relinquish before surface Destroy
56 kSurfaceDestroyedRecently, // surface Destroy before Relinquish
59 void CreateDisplayTypeAndWindowIfNeeded();
60 void DestroyDisplayTypeAndWindow();
61 void InitializeHardware();
62 void ShutdownHardware();
64 HardwareState state_;
65 DestroyWindowPendingState destroy_window_pending_state_;
66 base::Closure relinquish_display_callback_;
67 void* display_type_;
68 bool have_display_type_;
69 void* window_;
70 gfx::Size display_size_;
71 gfx::Size new_display_size_;
72 scoped_ptr<chromecast::CastEglPlatform> egl_platform_;
74 DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryCast);
77 } // namespace ui
79 #endif // UI_OZONE_PLATFORM_CAST_SURFACE_FACTORY_CAST_H_