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/default_capture_client.h" | 11 #include "ui/aura/client/default_capture_client.h" |
12 #include "ui/aura/client/stacking_client.h" | 12 #include "ui/aura/client/stacking_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_screen.h" | 15 #include "ui/aura/test/test_screen.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" | |
23 #include "ui/gfx/canvas.h" | 22 #include "ui/gfx/canvas.h" |
24 #include "ui/gfx/rect.h" | 23 #include "ui/gfx/rect.h" |
25 | 24 |
26 #if defined(USE_X11) | 25 #if defined(USE_X11) |
27 #include "base/message_pump_aurax11.h" | 26 #include "base/message_pump_aurax11.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. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 aura::RootWindow* root_window_; | 102 aura::RootWindow* root_window_; |
104 | 103 |
105 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; | 104 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_; |
106 | 105 |
107 DISALLOW_COPY_AND_ASSIGN(DemoStackingClient); | 106 DISALLOW_COPY_AND_ASSIGN(DemoStackingClient); |
108 }; | 107 }; |
109 | 108 |
110 int DemoMain() { | 109 int DemoMain() { |
111 // Create the message-loop here before creating the root window. | 110 // Create the message-loop here before creating the root window. |
112 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); | 111 base::MessageLoop message_loop(base::MessageLoop::TYPE_UI); |
113 ui::CompositorTestSupport::Initialize(); | |
114 aura::Env::GetInstance(); | 112 aura::Env::GetInstance(); |
115 scoped_ptr<aura::TestScreen> test_screen(aura::TestScreen::Create()); | 113 scoped_ptr<aura::TestScreen> test_screen(aura::TestScreen::Create()); |
116 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get()); | 114 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get()); |
117 scoped_ptr<aura::RootWindow> root_window( | 115 scoped_ptr<aura::RootWindow> root_window( |
118 test_screen->CreateRootWindowForPrimaryDisplay()); | 116 test_screen->CreateRootWindowForPrimaryDisplay()); |
119 scoped_ptr<DemoStackingClient> stacking_client(new DemoStackingClient( | 117 scoped_ptr<DemoStackingClient> stacking_client(new DemoStackingClient( |
120 root_window.get())); | 118 root_window.get())); |
121 | 119 |
122 // Create a hierarchy of test windows. | 120 // Create a hierarchy of test windows. |
123 DemoWindowDelegate window_delegate1(SK_ColorBLUE); | 121 DemoWindowDelegate window_delegate1(SK_ColorBLUE); |
(...skipping 16 matching lines...) Expand all Loading... |
140 aura::Window window3(&window_delegate3); | 138 aura::Window window3(&window_delegate3); |
141 window3.set_id(3); | 139 window3.set_id(3); |
142 window3.Init(ui::LAYER_TEXTURED); | 140 window3.Init(ui::LAYER_TEXTURED); |
143 window3.SetBounds(gfx::Rect(10, 10, 50, 50)); | 141 window3.SetBounds(gfx::Rect(10, 10, 50, 50)); |
144 window3.Show(); | 142 window3.Show(); |
145 window2.AddChild(&window3); | 143 window2.AddChild(&window3); |
146 | 144 |
147 root_window->ShowRootWindow(); | 145 root_window->ShowRootWindow(); |
148 base::MessageLoopForUI::current()->Run(); | 146 base::MessageLoopForUI::current()->Run(); |
149 | 147 |
150 ui::CompositorTestSupport::Terminate(); | |
151 | |
152 return 0; | 148 return 0; |
153 } | 149 } |
154 | 150 |
155 } // namespace | 151 } // namespace |
156 | 152 |
157 int main(int argc, char** argv) { | 153 int main(int argc, char** argv) { |
158 CommandLine::Init(argc, argv); | 154 CommandLine::Init(argc, argv); |
159 | 155 |
160 // The exit manager is in charge of calling the dtors of singleton objects. | 156 // The exit manager is in charge of calling the dtors of singleton objects. |
161 base::AtExitManager exit_manager; | 157 base::AtExitManager exit_manager; |
162 | 158 |
163 ui::RegisterPathProvider(); | 159 ui::RegisterPathProvider(); |
164 icu_util::Initialize(); | 160 icu_util::Initialize(); |
165 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); | 161 ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); |
166 | 162 |
167 return DemoMain(); | 163 return DemoMain(); |
168 } | 164 } |
OLD | NEW |