Home | History | Annotate | Download | only in ozone
      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.
      4 
      5 #include "ui/base/ozone/surface_factory_ozone.h"
      6 
      7 #include <stdlib.h>
      8 
      9 namespace ui {
     10 
     11 // static
     12 SurfaceFactoryOzone* SurfaceFactoryOzone::impl_ = NULL;
     13 
     14 class SurfaceFactoryOzoneStub : public SurfaceFactoryOzone {
     15  public:
     16   SurfaceFactoryOzoneStub() {}
     17   virtual ~SurfaceFactoryOzoneStub() {}
     18 
     19   virtual void InitializeHardware() OVERRIDE {}
     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;
     25   }
     26   virtual bool LoadEGLGLES2Bindings() OVERRIDE { return true; }
     27   virtual bool AttemptToResizeAcceleratedWidget(
     28       gfx::AcceleratedWidget w,
     29       const gfx::Rect& bounds) OVERRIDE {
     30     return false;
     31   }
     32   virtual gfx::VSyncProvider* GetVSyncProvider(
     33       gfx::AcceleratedWidget w) OVERRIDE {
     34     return NULL;
     35   }
     36 };
     37 
     38 SurfaceFactoryOzone::SurfaceFactoryOzone() {
     39 }
     40 
     41 SurfaceFactoryOzone::~SurfaceFactoryOzone() {
     42 }
     43 
     44 SurfaceFactoryOzone* SurfaceFactoryOzone::GetInstance() {
     45   CHECK(impl_) << "SurfaceFactoryOzone accessed before constructed";
     46   return impl_;
     47 }
     48 
     49 void SurfaceFactoryOzone::SetInstance(SurfaceFactoryOzone* impl) {
     50   impl_ = impl;
     51 }
     52 
     53 const char* SurfaceFactoryOzone::DefaultDisplaySpec() {
     54   char* envvar = getenv("ASH_DISPLAY_SPEC");
     55   if (envvar)
     56     return envvar;
     57   return  "720x1280*2";
     58 }
     59 
     60 // static
     61 SurfaceFactoryOzone* SurfaceFactoryOzone::CreateTestHelper() {
     62   return new SurfaceFactoryOzoneStub;
     63 }
     64 
     65 }  // namespace ui
     66