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 COMPONENTS_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_
6 #define COMPONENTS_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_
8 #include "base/memory/ref_counted.h"
9 #include "components/gpu/public/interfaces/context_provider.mojom.h"
10 #include "components/gpu/public/interfaces/viewport_parameter_listener.mojom.h"
11 #include "ui/gfx/native_widget_types.h"
17 namespace native_viewport
{
19 class OnscreenContextProvider
: public mojo::ContextProvider
{
21 explicit OnscreenContextProvider(const scoped_refptr
<gles2::GpuState
>& state
);
22 ~OnscreenContextProvider() override
;
24 void Bind(mojo::InterfaceRequest
<mojo::ContextProvider
> request
);
26 void SetAcceleratedWidget(gfx::AcceleratedWidget widget
);
29 // mojo::ContextProvider implementation:
30 void Create(mojo::ViewportParameterListenerPtr viewport_parameter_listener
,
31 const CreateCallback
& callback
) override
;
33 void CreateAndReturnCommandBuffer();
35 scoped_refptr
<gles2::GpuState
> state_
;
36 gfx::AcceleratedWidget widget_
;
37 mojo::ViewportParameterListenerPtr pending_listener_
;
38 CreateCallback pending_create_callback_
;
39 mojo::Binding
<mojo::ContextProvider
> binding_
;
41 DISALLOW_COPY_AND_ASSIGN(OnscreenContextProvider
);
46 #endif // COMPONENTS_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_