Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Unified Diff: ui/base/linux/native_surface_linux_factory.cc

Issue 13886018: Add a factory and defines for native Linux surfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
DaveMoore 2013/04/30 17:53:42 Nit: no braces (other places in file too).
rjkroege 2013/05/06 18:46:24 Done.
+ }
+}
+
+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

Powered by Google App Engine
This is Rietveld 408576698