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/single_display_manager.h" | 14 #include "ui/aura/single_display_manager.h" |
15 #include "ui/aura/shared/root_window_capture_client.h" | 15 #include "ui/aura/shared/root_window_capture_client.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/event.h" | 18 #include "ui/base/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 | |
30 namespace { | 32 namespace { |
31 | 33 |
32 // Trivial WindowDelegate implementation that draws a colored background. | 34 // Trivial WindowDelegate implementation that draws a colored background. |
33 class DemoWindowDelegate : public aura::WindowDelegate { | 35 class DemoWindowDelegate : public aura::WindowDelegate { |
34 public: | 36 public: |
35 explicit DemoWindowDelegate(SkColor color) : color_(color) {} | 37 explicit DemoWindowDelegate(SkColor color) : color_(color) {} |
36 | 38 |
37 // Overridden from WindowDelegate: | 39 // Overridden from WindowDelegate: |
38 virtual gfx::Size GetMinimumSize() const OVERRIDE { | 40 virtual gfx::Size GetMinimumSize() const OVERRIDE { |
39 return gfx::Size(); | 41 return gfx::Size(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
107 } | 109 } |
108 | 110 |
109 private: | 111 private: |
110 aura::RootWindow* root_window_; | 112 aura::RootWindow* root_window_; |
111 | 113 |
112 scoped_ptr<aura::shared::RootWindowCaptureClient> capture_client_; | 114 scoped_ptr<aura::shared::RootWindowCaptureClient> capture_client_; |
113 | 115 |
114 DISALLOW_COPY_AND_ASSIGN(DemoStackingClient); | 116 DISALLOW_COPY_AND_ASSIGN(DemoStackingClient); |
115 }; | 117 }; |
116 | 118 |
117 } // namespace | 119 int DemoMain() { |
118 | |
119 int main(int argc, char** argv) { | |
120 CommandLine::Init(argc, argv); | |
121 | |
122 // The exit manager is in charge of calling the dtors of singleton objects. | |
123 base::AtExitManager exit_manager; | |
124 | |
125 ui::RegisterPathProvider(); | |
126 icu_util::Initialize(); | |
127 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | |
128 | |
129 // Create the message-loop here before creating the root window. | 120 // Create the message-loop here before creating the root window. |
130 MessageLoop message_loop(MessageLoop::TYPE_UI); | 121 MessageLoop message_loop(MessageLoop::TYPE_UI); |
131 ui::CompositorTestSupport::Initialize(); | 122 ui::CompositorTestSupport::Initialize(); |
132 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); | 123 aura::Env::GetInstance()->SetDisplayManager(new aura::SingleDisplayManager); |
133 scoped_ptr<aura::RootWindow> root_window( | 124 scoped_ptr<aura::RootWindow> root_window( |
134 aura::DisplayManager::CreateRootWindowForPrimaryDisplay()); | 125 aura::DisplayManager::CreateRootWindowForPrimaryDisplay()); |
135 scoped_ptr<DemoStackingClient> stacking_client(new DemoStackingClient( | 126 scoped_ptr<DemoStackingClient> stacking_client(new DemoStackingClient( |
136 root_window.get())); | 127 root_window.get())); |
137 | 128 |
138 // Create a hierarchy of test windows. | 129 // Create a hierarchy of test windows. |
(...skipping 21 matching lines...) Expand all Loading... | |
160 window3.Show(); | 151 window3.Show(); |
161 window3.SetParent(&window2); | 152 window3.SetParent(&window2); |
162 | 153 |
163 root_window->ShowRootWindow(); | 154 root_window->ShowRootWindow(); |
164 MessageLoopForUI::current()->Run(); | 155 MessageLoopForUI::current()->Run(); |
165 | 156 |
166 ui::CompositorTestSupport::Terminate(); | 157 ui::CompositorTestSupport::Terminate(); |
167 | 158 |
168 return 0; | 159 return 0; |
169 } | 160 } |
161 | |
162 int RunMain() { | |
163 // TODO(scottmg): Something not crappy. | |
164 if (CommandLine::ForCurrentProcess()->HasSwitch("viewer")) { | |
165 return ViewerProcessMain(); | |
166 } else { | |
167 return DemoMain(); | |
168 } | |
169 } | |
170 | |
171 } // namespace | |
172 | |
173 int main(int argc, char** argv) { | |
174 CommandLine::Init(argc, argv); | |
175 | |
176 // The exit manager is in charge of calling the dtors of singleton objects. | |
177 base::AtExitManager exit_manager; | |
178 | |
179 ui::RegisterPathProvider(); | |
180 icu_util::Initialize(); | |
181 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | |
tfarina
2012/08/28 01:17:08
ui::ResourceBundle
| |
182 | |
183 return RunMain(); | |
184 } | |
OLD | NEW |