Add support for over-riding config attribute values.
[chromium-blink-merge.git] / ui / gfx / ozone / surface_factory_ozone.cc
blobca67228d4b1d178e14858c949fcb3f604b22a8b4
1 // Copyright (c) 2013 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 "ui/gfx/ozone/surface_factory_ozone.h"
7 #include <stdlib.h>
9 namespace gfx {
11 // static
12 SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL;
14 class SurfaceFactoryOzoneStub : public SurfaceFactoryOzone {
15 public:
16 SurfaceFactoryOzoneStub() {}
17 virtual ~SurfaceFactoryOzoneStub() {}
19 virtual HardwareState InitializeHardware() OVERRIDE { return INITIALIZED; }
20 virtual void ShutdownHardware() OVERRIDE {}
21 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE { return 0; }
22 virtual gfx::AcceleratedWidget RealizeAcceleratedWidget(
23 gfx::AcceleratedWidget w) OVERRIDE {
24 return 0;
26 virtual bool LoadEGLGLES2Bindings() OVERRIDE { return true; }
27 virtual bool AttemptToResizeAcceleratedWidget(
28 gfx::AcceleratedWidget w,
29 const gfx::Rect& bounds) OVERRIDE {
30 return false;
32 virtual gfx::VSyncProvider* GetVSyncProvider(
33 gfx::AcceleratedWidget w) OVERRIDE {
34 return NULL;
38 SurfaceFactoryOzone::SurfaceFactoryOzone() {
41 SurfaceFactoryOzone::~SurfaceFactoryOzone() {
44 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() {
45 CHECK(impl_) << "SurfaceFactoryOzone accessed before constructed";
46 return impl_;
49 void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) {
50 impl_ = impl;
53 const char* SurfaceFactoryOzone::DefaultDisplaySpec() {
54 char* envvar = getenv("ASH_DISPLAY_SPEC");
55 if (envvar)
56 return envvar;
57 return "720x1280*2";
60 gfx::Screen* SurfaceFactoryOzone::CreateDesktopScreen() {
61 return NULL;
64 intptr_t SurfaceFactoryOzone::GetNativeDisplay() {
65 return 0;
68 bool SurfaceFactoryOzone::SchedulePageFlip(gfx::AcceleratedWidget) {
69 return true;
72 const int32* SurfaceFactoryOzone::GetEGLSurfaceProperties(
73 const int32* desired_attributes) {
74 return desired_attributes;
77 // static
78 SurfaceFactoryOzone* SurfaceFactoryOzone::CreateTestHelper() {
79 return new SurfaceFactoryOzoneStub;
82 } // namespace gfx