| 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.h" | 9 #include "base/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/stacking_client.h" | 11 #include "ui/aura/client/stacking_client.h" |
| 12 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
| 14 #include "ui/aura/shared/root_window_capture_client.h" | 14 #include "ui/aura/shared/root_window_capture_client.h" |
| 15 #include "ui/aura/single_display_manager.h" | 15 #include "ui/aura/single_display_manager.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_delegate.h" | 17 #include "ui/aura/window_delegate.h" |
| 18 #include "ui/base/events/event.h" | 18 #include "ui/base/events/event.h" |
| 19 #include "ui/base/hit_test.h" | 19 #include "ui/base/hit_test.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/base/ui_base_paths.h" | 21 #include "ui/base/ui_base_paths.h" |
| 22 #include "ui/compositor/test/compositor_test_support.h" | 22 #include "ui/compositor/test/compositor_test_support.h" |
| 23 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
| 24 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
| 25 | 25 |
| 26 #if defined(USE_X11) | 26 #if defined(USE_X11) |
| 27 #include "base/message_pump_aurax11.h" | 27 #include "base/message_pump_aurax11.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 extern int ViewerProcessMain(); | |
| 31 | |
| 32 namespace { | 30 namespace { |
| 33 | 31 |
| 34 // Trivial WindowDelegate implementation that draws a colored background. | 32 // Trivial WindowDelegate implementation that draws a colored background. |
| 35 class DemoWindowDelegate : public aura::WindowDelegate { | 33 class DemoWindowDelegate : public aura::WindowDelegate { |
| 36 public: | 34 public: |
| 37 explicit DemoWindowDelegate(SkColor color) : color_(color) {} | 35 explicit DemoWindowDelegate(SkColor color) : color_(color) {} |
| 38 | 36 |
| 39 // Overridden from WindowDelegate: | 37 // Overridden from WindowDelegate: |
| 40 virtual gfx::Size GetMinimumSize() const OVERRIDE { | 38 virtual gfx::Size GetMinimumSize() const OVERRIDE { |
| 41 return gfx::Size(); | 39 return gfx::Size(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 window3.SetParent(&window2); | 154 window3.SetParent(&window2); |
| 157 | 155 |
| 158 root_window->ShowRootWindow(); | 156 root_window->ShowRootWindow(); |
| 159 MessageLoopForUI::current()->Run(); | 157 MessageLoopForUI::current()->Run(); |
| 160 | 158 |
| 161 ui::CompositorTestSupport::Terminate(); | 159 ui::CompositorTestSupport::Terminate(); |
| 162 | 160 |
| 163 return 0; | 161 return 0; |
| 164 } | 162 } |
| 165 | 163 |
| 166 int RunMain() { | |
| 167 // TODO(scottmg): Something not crappy. | |
| 168 if (CommandLine::ForCurrentProcess()->HasSwitch("viewer")) { | |
| 169 return ViewerProcessMain(); | |
| 170 } else { | |
| 171 return DemoMain(); | |
| 172 } | |
| 173 } | |
| 174 | |
| 175 } // namespace | 164 } // namespace |
| 176 | 165 |
| 177 int main(int argc, char** argv) { | 166 int main(int argc, char** argv) { |
| 178 CommandLine::Init(argc, argv); | 167 CommandLine::Init(argc, argv); |
| 179 | 168 |
| 180 // The exit manager is in charge of calling the dtors of singleton objects. | 169 // The exit manager is in charge of calling the dtors of singleton objects. |
| 181 base::AtExitManager exit_manager; | 170 base::AtExitManager exit_manager; |
| 182 | 171 |
| 183 ui::RegisterPathProvider(); | 172 ui::RegisterPathProvider(); |
| 184 icu_util::Initialize(); | 173 icu_util::Initialize(); |
| 185 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 174 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
| 186 | 175 |
| 187 return RunMain(); | 176 return DemoMain(); |
| 188 } | 177 } |
| OLD | NEW |