Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / mandoline / ui / aura / surface_context_factory.cc
blob2e8d7a5cef9a4dc8410607131dc3c2b6e2c64747
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 #include "mandoline/ui/aura/surface_context_factory.h"
7 #include "cc/output/output_surface.h"
8 #include "cc/resources/shared_bitmap_manager.h"
9 #include "cc/surfaces/surface_id_allocator.h"
10 #include "components/view_manager/public/cpp/view.h"
11 #include "mojo/application/public/interfaces/shell.mojom.h"
12 #include "ui/compositor/reflector.h"
13 #include "ui/gl/gl_bindings.h"
15 namespace mandoline {
16 namespace {
18 class FakeReflector : public ui::Reflector {
19 public:
20 FakeReflector() {}
21 ~FakeReflector() override {}
22 void OnMirroringCompositorResized() override {}
23 void AddMirroringLayer(ui::Layer* layer) override {}
24 void RemoveMirroringLayer(ui::Layer* layer) override {}
29 SurfaceContextFactory::SurfaceContextFactory(mojo::Shell* shell,
30 mojo::View* view)
31 : surface_binding_(shell, view),
32 next_surface_id_namespace_(1u) {
35 SurfaceContextFactory::~SurfaceContextFactory() {
38 void SurfaceContextFactory::CreateOutputSurface(
39 base::WeakPtr<ui::Compositor> compositor) {
40 NOTIMPLEMENTED();
41 compositor->SetOutputSurface(surface_binding_.CreateOutputSurface());
44 scoped_ptr<ui::Reflector> SurfaceContextFactory::CreateReflector(
45 ui::Compositor* mirroed_compositor,
46 ui::Layer* mirroring_layer) {
47 NOTIMPLEMENTED();
48 return make_scoped_ptr(new FakeReflector);
51 void SurfaceContextFactory::RemoveReflector(ui::Reflector* reflector) {
52 NOTIMPLEMENTED();
55 scoped_refptr<cc::ContextProvider>
56 SurfaceContextFactory::SharedMainThreadContextProvider() {
57 NOTIMPLEMENTED();
58 return nullptr;
61 void SurfaceContextFactory::RemoveCompositor(ui::Compositor* compositor) {
62 NOTIMPLEMENTED();
65 bool SurfaceContextFactory::DoesCreateTestContexts() {
66 return false;
69 uint32 SurfaceContextFactory::GetImageTextureTarget(gfx::BufferFormat format,
70 gfx::BufferUsage usage) {
71 // No GpuMemoryBuffer support, so just return GL_TEXTURE_2D.
72 return GL_TEXTURE_2D;
75 cc::SharedBitmapManager* SurfaceContextFactory::GetSharedBitmapManager() {
76 NOTIMPLEMENTED();
77 return nullptr;
80 gpu::GpuMemoryBufferManager*
81 SurfaceContextFactory::GetGpuMemoryBufferManager() {
82 return &gpu_memory_buffer_manager_;
85 cc::TaskGraphRunner* SurfaceContextFactory::GetTaskGraphRunner() {
86 return raster_thread_helper_.task_graph_runner();
89 scoped_ptr<cc::SurfaceIdAllocator>
90 SurfaceContextFactory::CreateSurfaceIdAllocator() {
91 return make_scoped_ptr(
92 new cc::SurfaceIdAllocator(next_surface_id_namespace_++));
95 void SurfaceContextFactory::ResizeDisplay(ui::Compositor* compositor,
96 const gfx::Size& size) {
97 NOTIMPLEMENTED();
100 } // namespace mandoline