| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if defined(USE_X11) |
| 6 #include <X11/Xlib.h> |
| 7 #endif |
| 8 |
| 5 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 7 #include "base/i18n/icu_util.h" | 11 #include "base/i18n/icu_util.h" |
| 8 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 10 #include "third_party/skia/include/core/SkXfermode.h" | 14 #include "third_party/skia/include/core/SkXfermode.h" |
| 11 #include "ui/aura/client/default_capture_client.h" | 15 #include "ui/aura/client/default_capture_client.h" |
| 12 #include "ui/aura/client/window_tree_client.h" | 16 #include "ui/aura/client/window_tree_client.h" |
| 13 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
| 14 #include "ui/aura/test/test_focus_client.h" | 18 #include "ui/aura/test/test_focus_client.h" |
| 15 #include "ui/aura/test/test_screen.h" | 19 #include "ui/aura/test/test_screen.h" |
| 16 #include "ui/aura/window.h" | 20 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_delegate.h" | 21 #include "ui/aura/window_delegate.h" |
| 18 #include "ui/aura/window_tree_host.h" | 22 #include "ui/aura/window_tree_host.h" |
| 19 #include "ui/base/hit_test.h" | 23 #include "ui/base/hit_test.h" |
| 20 #include "ui/compositor/test/in_process_context_factory.h" | 24 #include "ui/compositor/test/in_process_context_factory.h" |
| 21 #include "ui/events/event.h" | 25 #include "ui/events/event.h" |
| 22 #include "ui/gfx/canvas.h" | 26 #include "ui/gfx/canvas.h" |
| 23 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
| 24 #include "ui/gl/gl_surface.h" | 28 #include "ui/gl/gl_surface.h" |
| 25 | 29 |
| 26 #if defined(USE_X11) | 30 #if defined(USE_X11) |
| 27 #include "ui/gfx/x/x11_connection.h" | 31 #include "base/message_loop/message_pump_x11.h" |
| 28 #endif | 32 #endif |
| 29 | 33 |
| 30 namespace { | 34 namespace { |
| 31 | 35 |
| 32 // Trivial WindowDelegate implementation that draws a colored background. | 36 // Trivial WindowDelegate implementation that draws a colored background. |
| 33 class DemoWindowDelegate : public aura::WindowDelegate { | 37 class DemoWindowDelegate : public aura::WindowDelegate { |
| 34 public: | 38 public: |
| 35 explicit DemoWindowDelegate(SkColor color) : color_(color) {} | 39 explicit DemoWindowDelegate(SkColor color) : color_(color) {} |
| 36 | 40 |
| 37 // Overridden from WindowDelegate: | 41 // Overridden from WindowDelegate: |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 104 |
| 101 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | 105 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |
| 102 | 106 |
| 103 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); | 107 DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); |
| 104 }; | 108 }; |
| 105 | 109 |
| 106 int DemoMain() { | 110 int DemoMain() { |
| 107 #if defined(USE_X11) | 111 #if defined(USE_X11) |
| 108 // This demo uses InProcessContextFactory which uses X on a separate Gpu | 112 // This demo uses InProcessContextFactory which uses X on a separate Gpu |
| 109 // thread. | 113 // thread. |
| 110 gfx::InitializeThreadedX11(); | 114 XInitThreads(); |
| 111 #endif | 115 #endif |
| 112 | 116 |
| 113 gfx::GLSurface::InitializeOneOff(); | 117 gfx::GLSurface::InitializeOneOff(); |
| 114 | 118 |
| 115 // The ContextFactory must exist before any Compositors are created. | 119 // The ContextFactory must exist before any Compositors are created. |
| 116 scoped_ptr<ui::InProcessContextFactory> context_factory( | 120 scoped_ptr<ui::InProcessContextFactory> context_factory( |
| 117 new ui::InProcessContextFactory()); | 121 new ui::InProcessContextFactory()); |
| 118 ui::ContextFactory::SetInstance(context_factory.get()); | 122 ui::ContextFactory::SetInstance(context_factory.get()); |
| 119 | 123 |
| 120 // Create the message-loop here before creating the root window. | 124 // Create the message-loop here before creating the root window. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 int main(int argc, char** argv) { | 170 int main(int argc, char** argv) { |
| 167 CommandLine::Init(argc, argv); | 171 CommandLine::Init(argc, argv); |
| 168 | 172 |
| 169 // The exit manager is in charge of calling the dtors of singleton objects. | 173 // The exit manager is in charge of calling the dtors of singleton objects. |
| 170 base::AtExitManager exit_manager; | 174 base::AtExitManager exit_manager; |
| 171 | 175 |
| 172 base::i18n::InitializeICU(); | 176 base::i18n::InitializeICU(); |
| 173 | 177 |
| 174 return DemoMain(); | 178 return DemoMain(); |
| 175 } | 179 } |
| OLD | NEW |