| 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 #include "base/at_exit.h" |    5 #include "base/at_exit.h" | 
|    6 #include "base/command_line.h" |    6 #include "base/command_line.h" | 
|    7 #include "base/i18n/icu_util.h" |    7 #include "base/i18n/icu_util.h" | 
|    8 #include "base/memory/scoped_ptr.h" |    8 #include "base/memory/scoped_ptr.h" | 
|    9 #include "base/message_loop/message_loop.h" |    9 #include "base/message_loop/message_loop.h" | 
|   10 #include "third_party/skia/include/core/SkXfermode.h" |   10 #include "third_party/skia/include/core/SkXfermode.h" | 
|   11 #include "ui/aura/client/default_capture_client.h" |   11 #include "ui/aura/client/default_capture_client.h" | 
|   12 #include "ui/aura/client/window_tree_client.h" |   12 #include "ui/aura/client/window_tree_client.h" | 
|   13 #include "ui/aura/env.h" |   13 #include "ui/aura/env.h" | 
|   14 #include "ui/aura/root_window.h" |   14 #include "ui/aura/root_window.h" | 
|   15 #include "ui/aura/test/test_focus_client.h" |   15 #include "ui/aura/test/test_focus_client.h" | 
|   16 #include "ui/aura/test/test_screen.h" |   16 #include "ui/aura/test/test_screen.h" | 
|   17 #include "ui/aura/window.h" |   17 #include "ui/aura/window.h" | 
|   18 #include "ui/aura/window_delegate.h" |   18 #include "ui/aura/window_delegate.h" | 
|   19 #include "ui/base/hit_test.h" |   19 #include "ui/base/hit_test.h" | 
|   20 #include "ui/compositor/test/context_factories_for_test.h" |   20 #include "ui/compositor/test/context_factories_for_test.h" | 
|   21 #include "ui/events/event.h" |   21 #include "ui/events/event.h" | 
|   22 #include "ui/gfx/canvas.h" |   22 #include "ui/gfx/canvas.h" | 
|   23 #include "ui/gfx/rect.h" |   23 #include "ui/gfx/rect.h" | 
|   24 #include "ui/gl/gl_surface.h" |  | 
|   25  |   24  | 
|   26 #if defined(USE_X11) |   25 #if defined(USE_X11) | 
|   27 #include "base/message_loop/message_pump_x11.h" |   26 #include "base/message_loop/message_pump_x11.h" | 
|   28 #endif |   27 #endif | 
|   29  |   28  | 
|   30 namespace { |   29 namespace { | 
|   31  |   30  | 
|   32 // Trivial WindowDelegate implementation that draws a colored background. |   31 // Trivial WindowDelegate implementation that draws a colored background. | 
|   33 class DemoWindowDelegate : public aura::WindowDelegate { |   32 class DemoWindowDelegate : public aura::WindowDelegate { | 
|   34  public: |   33  public: | 
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  102  |  101  | 
|  103   scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |  102   scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | 
|  104  |  103  | 
|  105   DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); |  104   DISALLOW_COPY_AND_ASSIGN(DemoWindowTreeClient); | 
|  106 }; |  105 }; | 
|  107  |  106  | 
|  108 int DemoMain() { |  107 int DemoMain() { | 
|  109   // Create the message-loop here before creating the root window. |  108   // Create the message-loop here before creating the root window. | 
|  110   base::MessageLoopForUI message_loop; |  109   base::MessageLoopForUI message_loop; | 
|  111  |  110  | 
|  112   gfx::GLSurface::InitializeOneOff(); |  | 
|  113  |  | 
|  114   // The ContextFactory must exist before any Compositors are created. |  111   // The ContextFactory must exist before any Compositors are created. | 
|  115   bool allow_test_contexts = false; |  112   bool allow_test_contexts = false; | 
|  116   ui::InitializeContextFactoryForTests(allow_test_contexts); |  113   ui::InitializeContextFactoryForTests(allow_test_contexts); | 
|  117  |  114  | 
|  118   aura::Env::CreateInstance(); |  115   aura::Env::CreateInstance(); | 
|  119   scoped_ptr<aura::TestScreen> test_screen(aura::TestScreen::Create()); |  116   scoped_ptr<aura::TestScreen> test_screen(aura::TestScreen::Create()); | 
|  120   gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get()); |  117   gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get()); | 
|  121   scoped_ptr<aura::RootWindow> root_window( |  118   scoped_ptr<aura::RootWindow> root_window( | 
|  122       test_screen->CreateRootWindowForPrimaryDisplay()); |  119       test_screen->CreateRootWindowForPrimaryDisplay()); | 
|  123   scoped_ptr<DemoWindowTreeClient> window_tree_client(new DemoWindowTreeClient( |  120   scoped_ptr<DemoWindowTreeClient> window_tree_client(new DemoWindowTreeClient( | 
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  163 int main(int argc, char** argv) { |  160 int main(int argc, char** argv) { | 
|  164   CommandLine::Init(argc, argv); |  161   CommandLine::Init(argc, argv); | 
|  165  |  162  | 
|  166   // The exit manager is in charge of calling the dtors of singleton objects. |  163   // The exit manager is in charge of calling the dtors of singleton objects. | 
|  167   base::AtExitManager exit_manager; |  164   base::AtExitManager exit_manager; | 
|  168  |  165  | 
|  169   base::i18n::InitializeICU(); |  166   base::i18n::InitializeICU(); | 
|  170  |  167  | 
|  171   return DemoMain(); |  168   return DemoMain(); | 
|  172 } |  169 } | 
| OLD | NEW |