Chromium Code Reviews| Index: chromecast/ozone/surface_factory_chromecast.h |
| diff --git a/chromecast/ozone/surface_factory_chromecast.h b/chromecast/ozone/surface_factory_chromecast.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a94e8677f8f7ff9345ea5bce956b1f854872c605 |
| --- /dev/null |
| +++ b/chromecast/ozone/surface_factory_chromecast.h |
| @@ -0,0 +1,74 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROMECAST_OZONE_SURFACE_FACTORY_CHROMECAST_H_ |
| +#define CHROMECAST_OZONE_SURFACE_FACTORY_CHROMECAST_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "ui/gfx/geometry/size.h" |
| +#include "ui/ozone/public/surface_factory_ozone.h" |
| + |
| +namespace chromecast { |
| +namespace ozone { |
| + |
| +class ChromecastEglPlatform; |
| + |
| +// SurfaceFactoryOzone implementation for OzonePlatformChromecast. |
| +class SurfaceFactoryChromecast : public ui::SurfaceFactoryOzone { |
| + public: |
| + SurfaceFactoryChromecast(scoped_ptr<ChromecastEglPlatform> egl_platform); |
|
lcwu1
2015/03/27 00:51:43
Add 'explicit'.
halliwell
2015/03/27 01:45:03
Done.
|
| + ~SurfaceFactoryChromecast() override; |
| + |
| + // ui::SurfaceFactoryOzone implementation: |
| + intptr_t GetNativeDisplay() override; |
| + scoped_ptr<ui::SurfaceOzoneEGL> CreateEGLSurfaceForWidget( |
| + gfx::AcceleratedWidget widget) override; |
| + const int32* GetEGLSurfaceProperties(const int32* desired_list) override; |
| + bool LoadEGLGLES2Bindings( |
| + AddGLLibraryCallback add_gl_library, |
| + SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; |
| + |
| + void SetToRelinquishDisplay(const base::Closure& callback); |
| + intptr_t GetNativeWindow(); |
| + bool ResizeDisplay(gfx::Size viewport_size); |
| + void ChildDestroyed(); |
| + void SendRelinquishResponse(); |
| + |
| + private: |
| + enum HardwareState { UNINITIALIZED, INITIALIZED, FAILED }; |
|
lcwu1
2015/03/27 00:51:43
Let's place each enumerator in its own line (which
halliwell
2015/03/27 01:45:03
Switching away from all-caps (I don't like that mu
|
| + |
| + // Window is destroyed if both SetToDestroyEGLDisplay() |
| + // and destructor are called (in either order) before the next |
| + // SurfaceOzoneEglChromecast is created in order to preserve the |
| + // window across surface creation whenever possible. |
| + enum DestroyWindowPendingState { |
| + kNoDestroyPending = 0, // Surface does not exist |
| + kSurfaceExists, // surface and window both exist |
| + kWindowDestroyPending, // Relinquish before surface Destroy |
| + kSurfaceDestroyedRecently, // surface Destroy before Relinquish |
| + }; |
| + |
| + void CreateDisplayTypeAndWindowIfNeeded(); |
| + void DestroyDisplayTypeAndWindow(); |
| + void InitializeHardware(); |
| + void ShutdownHardware(); |
| + |
| + HardwareState state_; |
| + DestroyWindowPendingState destroy_window_pending_state_; |
| + base::Closure relinquish_display_callback_; |
| + intptr_t display_type_; |
| + intptr_t window_; |
| + const gfx::Size default_display_size_; |
| + gfx::Size display_size_; |
| + gfx::Size new_display_size_; |
| + scoped_ptr<ChromecastEglPlatform> egl_platform_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SurfaceFactoryChromecast); |
| +}; |
| + |
| +} // namespace ozone |
| +} // namespace chromecast |
| + |
| +#endif // CHROMECAST_OZONE_SURFACE_FACTORY_CHROMECAST_H_ |