Animate hiding security button on custom tab toolbar
[chromium-blink-merge.git] / components / view_manager / native_viewport / onscreen_context_provider.h
blob78edba70ef871e4aaa852eda07710db1b8e382d8
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_VIEW_MANAGER_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_
6 #define COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_
8 #include <set>
10 #include "base/memory/ref_counted.h"
11 #include "components/view_manager/gles2/command_buffer_impl_observer.h"
12 #include "components/view_manager/public/interfaces/context_provider.mojom.h"
13 #include "components/view_manager/public/interfaces/viewport_parameter_listener.mojom.h"
14 #include "ui/gfx/native_widget_types.h"
16 namespace gles2 {
17 class CommandBufferDriver;
18 class CommandBufferImpl;
19 class GpuState;
22 namespace native_viewport {
24 class OnscreenContextProvider : public mojo::ContextProvider,
25 public gles2::CommandBufferImplObserver {
26 public:
27 explicit OnscreenContextProvider(const scoped_refptr<gles2::GpuState>& state);
28 ~OnscreenContextProvider() override;
30 void Bind(mojo::InterfaceRequest<mojo::ContextProvider> request);
32 void SetAcceleratedWidget(gfx::AcceleratedWidget widget);
34 private:
35 // mojo::ContextProvider implementation:
36 void Create(mojo::ViewportParameterListenerPtr viewport_parameter_listener,
37 const CreateCallback& callback) override;
39 // gles2::CommandBufferImplObserver:
40 void OnCommandBufferImplDestroyed() override;
42 void CreateAndReturnCommandBuffer();
43 void CommandBufferDestroyed(gles2::CommandBufferDriver* command_buffer);
45 gles2::CommandBufferImpl* command_buffer_impl_;
46 scoped_refptr<gles2::GpuState> state_;
47 gfx::AcceleratedWidget widget_;
48 mojo::ViewportParameterListenerPtr pending_listener_;
49 CreateCallback pending_create_callback_;
50 mojo::Binding<mojo::ContextProvider> binding_;
51 std::set<gles2::CommandBufferDriver*> command_buffers_;
53 DISALLOW_COPY_AND_ASSIGN(OnscreenContextProvider);
56 } // namespace mojo
58 #endif // COMPONENTS_VIEW_MANAGER_NATIVE_VIEWPORT_ONSCREEN_CONTEXT_PROVIDER_H_