| Index: ui/base/linux/native_surface_linux_factory.cc
|
| diff --git a/ui/base/linux/native_surface_linux_factory.cc b/ui/base/linux/native_surface_linux_factory.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..86c09a8999d5a577f604f7176f0421f05f819b02
|
| --- /dev/null
|
| +++ b/ui/base/linux/native_surface_linux_factory.cc
|
| @@ -0,0 +1,72 @@
|
| +// Copyright (c) 2013 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.
|
| +
|
| +#include "ui/base/linux/native_surface_linux_factory.h"
|
| +
|
| +#include "base/memory/singleton.h"
|
| +#include "ui/base/linux/native_surface_linux_factory_delegate.h"
|
| +
|
| +namespace ui {
|
| +
|
| +NativeSurfaceLinuxFactory::NativeSurfaceLinuxFactory() {
|
| +}
|
| +
|
| +NativeSurfaceLinuxFactory::~NativeSurfaceLinuxFactory() {
|
| +}
|
| +
|
| +NativeSurfaceLinuxFactory* NativeSurfaceLinuxFactory::GetInstance() {
|
| + return Singleton<NativeSurfaceLinuxFactory>::get();
|
| + }
|
| +
|
| +void NativeSurfaceLinuxFactory::SetDelegate(
|
| + NativeSurfaceLinuxFactoryDelegate* delegate) {
|
| + delegate_.reset(delegate);
|
| +}
|
| +
|
| +const char* NativeSurfaceLinuxFactory::DefaultDisplaySpec() {
|
| + return getenv("ASH_DISPLAY_SPEC") ?: "720x1280*2";
|
| +}
|
| +
|
| +void NativeSurfaceLinuxFactory::InitializeHardware() {
|
| + if (delegate_) {
|
| + delegate_->InitializeHardware();
|
| + }
|
| +}
|
| +
|
| +void NativeSurfaceLinuxFactory::ShutdownHardware() {
|
| + if (delegate_) {
|
| + delegate_->ShutdownHardware();
|
| + }
|
| +}
|
| +
|
| +gfx::AcceleratedWidget NativeSurfaceLinuxFactory::GetAcceleratedWidget(
|
| + const gfx::GLSurfaceHandle& handle) {
|
| + if (delegate_) {
|
| + return delegate_->GetAcceleratedWidget(handle);
|
| + } else {
|
| + // TODO(rjkroege): Return appropriate AccleratedWidget for a
|
| + // KMS/DRM-backed native accelerated widget.
|
| + NOTIMPLEMENTED();
|
| + return (gfx::AcceleratedWidget)0;
|
| + }
|
| +}
|
| +
|
| +bool NativeSurfaceLinuxFactory::LoadEGLGLES2Bindings() {
|
| + if (delegate_) {
|
| + return delegate_->LoadEGLGLES2Bindings();
|
| + }
|
| + // TODO(rjkroege): Setup bindings for KMS/DRM GLES/EGL.
|
| + return false;
|
| +}
|
| +
|
| +bool NativeSurfaceLinuxFactory::AcceleratedWidgetCanBeResized(
|
| + gfx::AcceleratedWidget w) {
|
| + if (delegate_) {
|
| + return delegate_->AcceleratedWidgetCanBeResized(w);
|
| + } else {
|
| + return false;
|
| + }
|
| +}
|
| +
|
| +} // namespace ui
|
|
|