 
 This is patch is a hack and in principle shouldn't be extended much.
 ---
- ash/shell/content_client/shell_main_delegate.cc |    5 +++++
+ ash/shell/content_client/shell_main_delegate.cc |    9 +++++++++
  build/common.gypi                               |    6 ++++++
- chrome/app/chrome_main_delegate.cc              |    9 +++++++++
- content/shell/app/shell_main_delegate.cc        |   15 +++++++++++++++
+ chrome/app/chrome_main_delegate.cc              |   13 +++++++++++++
+ content/shell/app/shell_main_delegate.cc        |   21 +++++++++++++++++++++
  ui/aura/aura.gyp                                |    5 +++++
- ui/aura/demo/demo_main.cc                       |    9 +++++++++
- 6 files changed, 49 insertions(+)
+ ui/aura/demo/demo_main.cc                       |   14 ++++++++++++++
+ 6 files changed, 68 insertions(+)
 
 diff --git a/ash/shell/content_client/shell_main_delegate.cc b/ash/shell/content_client/shell_main_delegate.cc
-index 014fae1..d3b2705 100644
+index 014fae1..85ac652 100644
 --- a/ash/shell/content_client/shell_main_delegate.cc
 +++ b/ash/shell/content_client/shell_main_delegate.cc
-@@ -9,6 +9,8 @@
+@@ -9,6 +9,10 @@
  #include "content/public/common/content_switches.h"
  #include "ui/base/resource/resource_bundle.h"
  
-+#include "ozone/impl/ozone_display.h"
++#if defined(USE_OZONE)
++#include "ozone/impl/ozone_display.h"
++#endif
 +
  namespace ash {
  namespace shell {
  
-@@ -29,6 +31,9 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
+@@ -29,6 +33,11 @@ bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
  }
  
  void ShellMainDelegate::PreSandboxStartup() {
-+  /* TODO: Implementation specific. Has to go away */
-+  gfx::SurfaceFactoryOzone *o_factory = new ozonewayland::OzoneDisplay();
-+  gfx::SurfaceFactoryOzone::SetInstance(o_factory);
++#if defined(USE_OZONE)
++  /* TODO: Implementation specific. Has to go away */
++  gfx::SurfaceFactoryOzone *o_factory = new ozonewayland::OzoneDisplay();
++  gfx::SurfaceFactoryOzone::SetInstance(o_factory);
++#endif
    InitializeResourceBundle();
  }
  

     },
     {
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc
index abdd514..c4d6a63 100644
--- a/ui/aura/demo/demo_main.cc
+++ b/ui/aura/demo/demo_main.cc
@@ -24,6 +24,8 @@
 #include "ui/gfx/canvas.h"
 #include "ui/gfx/rect.h"
 
+#include "ozone/impl/ozone_display.h"
+
 #if defined(USE_X11)
 #include "base/message_loop/message_pump_x11.h"
 #endif
@@ -108,6 +110,10 @@ class DemoStackingClient : public aura::client::StackingClient {
 };
 
 int DemoMain() {
+  /* TODO: Implementation specific. Has to go away */
+  gfx::SurfaceFactoryOzone *o_factory = new ozonewayland::OzoneDisplay();
+  gfx::SurfaceFactoryOzone::SetInstance(o_factory);
+
   // Create the message-loop here before creating the root window.
   base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
 
@@ -153,6 +159,9 @@ int DemoMain() {
   root_window->ShowRootWindow();
   base::MessageLoopForUI::current()->Run();
 
+  o_factory->ShutdownHardware();
+  delete o_factory;
+
   return 0;
 }
 

From 4fc6ff1a10f685537508581f0a49b6dc5ed3c049 Mon Sep 17 00:00:00 2001
From: Tiago Vignatti <tiago.vignatti@intel.com>
Date: Mon, 23 Sep 2013 20:40:42 +0300
Subject: [PATCH] Set Wayland as the implementation for SurfaceFactoryOzone

