OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/desktop.h" | 11 #include "ui/aura/desktop.h" |
12 #include "ui/aura/event.h" | 12 #include "ui/aura/event.h" |
13 #include "ui/aura/hit_test.h" | 13 #include "ui/aura/hit_test.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 #include "ui/aura/window_delegate.h" | 15 #include "ui/aura/window_delegate.h" |
16 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
17 #include "ui/base/ui_base_paths.h" | 17 #include "ui/base/ui_base_paths.h" |
18 #include "ui/gfx/canvas_skia.h" | 18 #include "ui/gfx/canvas_skia.h" |
19 #include "ui/gfx/compositor/compositor_test_support.h" | |
20 #include "ui/gfx/rect.h" | 19 #include "ui/gfx/rect.h" |
21 | 20 |
22 #if defined(USE_X11) | 21 #if defined(USE_X11) |
23 #include "base/message_pump_x.h" | 22 #include "base/message_pump_x.h" |
24 #endif | 23 #endif |
25 | 24 |
26 namespace { | 25 namespace { |
27 | 26 |
28 // Trivial WindowDelegate implementation that draws a colored background. | 27 // Trivial WindowDelegate implementation that draws a colored background. |
29 class DemoWindowDelegate : public aura::WindowDelegate { | 28 class DemoWindowDelegate : public aura::WindowDelegate { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 74 |
76 // The exit manager is in charge of calling the dtors of singleton objects. | 75 // The exit manager is in charge of calling the dtors of singleton objects. |
77 base::AtExitManager exit_manager; | 76 base::AtExitManager exit_manager; |
78 | 77 |
79 ui::RegisterPathProvider(); | 78 ui::RegisterPathProvider(); |
80 icu_util::Initialize(); | 79 icu_util::Initialize(); |
81 ResourceBundle::InitSharedInstance("en-US"); | 80 ResourceBundle::InitSharedInstance("en-US"); |
82 | 81 |
83 // Create the message-loop here before creating the desktop. | 82 // Create the message-loop here before creating the desktop. |
84 MessageLoop message_loop(MessageLoop::TYPE_UI); | 83 MessageLoop message_loop(MessageLoop::TYPE_UI); |
85 ui::CompositorTestSupport::Initialize(); | |
86 | 84 |
87 aura::Desktop::GetInstance(); | 85 aura::Desktop::GetInstance(); |
88 | 86 |
89 // Create a hierarchy of test windows. | 87 // Create a hierarchy of test windows. |
90 DemoWindowDelegate window_delegate1(SK_ColorBLUE); | 88 DemoWindowDelegate window_delegate1(SK_ColorBLUE); |
91 aura::Window window1(&window_delegate1); | 89 aura::Window window1(&window_delegate1); |
92 window1.set_id(1); | 90 window1.set_id(1); |
93 window1.Init(ui::Layer::LAYER_HAS_TEXTURE); | 91 window1.Init(ui::Layer::LAYER_HAS_TEXTURE); |
94 window1.SetBounds(gfx::Rect(100, 100, 400, 400)); | 92 window1.SetBounds(gfx::Rect(100, 100, 400, 400)); |
95 window1.Show(); | 93 window1.Show(); |
96 window1.SetParent(NULL); | 94 window1.SetParent(NULL); |
97 | 95 |
98 DemoWindowDelegate window_delegate2(SK_ColorRED); | 96 DemoWindowDelegate window_delegate2(SK_ColorRED); |
99 aura::Window window2(&window_delegate2); | 97 aura::Window window2(&window_delegate2); |
100 window2.set_id(2); | 98 window2.set_id(2); |
101 window2.Init(ui::Layer::LAYER_HAS_TEXTURE); | 99 window2.Init(ui::Layer::LAYER_HAS_TEXTURE); |
102 window2.SetBounds(gfx::Rect(200, 200, 350, 350)); | 100 window2.SetBounds(gfx::Rect(200, 200, 350, 350)); |
103 window2.Show(); | 101 window2.Show(); |
104 window2.SetParent(NULL); | 102 window2.SetParent(NULL); |
105 | 103 |
106 DemoWindowDelegate window_delegate3(SK_ColorGREEN); | 104 DemoWindowDelegate window_delegate3(SK_ColorGREEN); |
107 aura::Window window3(&window_delegate3); | 105 aura::Window window3(&window_delegate3); |
108 window3.set_id(3); | 106 window3.set_id(3); |
109 window3.Init(ui::Layer::LAYER_HAS_TEXTURE); | 107 window3.Init(ui::Layer::LAYER_HAS_TEXTURE); |
110 window3.SetBounds(gfx::Rect(10, 10, 50, 50)); | 108 window3.SetBounds(gfx::Rect(10, 10, 50, 50)); |
111 window3.Show(); | 109 window3.Show(); |
112 window3.SetParent(&window2); | 110 window3.SetParent(&window2); |
113 | 111 |
114 aura::Desktop::GetInstance()->Run(); | 112 aura::Desktop::GetInstance()->Run(); |
115 | |
116 ui::CompositorTestSupport::Terminate(); | |
117 | |
118 return 0; | 113 return 0; |
119 } | 114 } |
120 | 115 |
OLD | NEW |