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 MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_
6 #define MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_
8 #include "base/memory/weak_ptr.h"
9 #include "cc/surfaces/surface_id.h"
10 #include "mojo/services/native_viewport/platform_viewport.h"
11 #include "mojo/services/public/interfaces/gpu/gpu.mojom.h"
12 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h"
13 #include "mojo/services/public/interfaces/surfaces/surfaces_service.mojom.h"
14 #include "ui/gfx/geometry/rect.h"
21 class ApplicationImpl;
22 class ViewportSurface;
24 class NativeViewportImpl : public InterfaceImpl<NativeViewport>,
25 public PlatformViewport::Delegate {
27 NativeViewportImpl(ApplicationImpl* app, bool is_headless);
28 virtual ~NativeViewportImpl();
30 // InterfaceImpl<NativeViewport> implementation.
31 virtual void Create(SizePtr bounds) OVERRIDE;
32 virtual void Show() OVERRIDE;
33 virtual void Hide() OVERRIDE;
34 virtual void Close() OVERRIDE;
35 virtual void SetBounds(SizePtr bounds) OVERRIDE;
36 virtual void SubmittedFrame(SurfaceIdPtr surface_id) OVERRIDE;
38 // PlatformViewport::Delegate implementation.
39 virtual void OnBoundsChanged(const gfx::Rect& bounds) OVERRIDE;
40 virtual void OnAcceleratedWidgetAvailable(
41 gfx::AcceleratedWidget widget) OVERRIDE;
42 virtual bool OnEvent(ui::Event* ui_event) OVERRIDE;
43 virtual void OnDestroyed() OVERRIDE;
49 scoped_ptr<PlatformViewport> platform_viewport_;
50 scoped_ptr<ViewportSurface> viewport_surface_;
54 SurfacesServicePtr surfaces_service_;
55 cc::SurfaceId child_surface_id_;
56 bool waiting_for_event_ack_;
57 base::WeakPtrFactory<NativeViewportImpl> weak_factory_;
59 DISALLOW_COPY_AND_ASSIGN(NativeViewportImpl);
64 #endif // MOJO_SERVICES_NATIVE_VIEWPORT_IMPL_H_