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/test/test_focus_client.h" | 14 #include "ui/aura/test/test_focus_client.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/aura/window_tree_host.h" | 18 #include "ui/aura/window_tree_host.h" |
19 #include "ui/base/hit_test.h" | 19 #include "ui/base/hit_test.h" |
20 #include "ui/compositor/test/in_process_context_factory.h" | 20 #include "ui/compositor/test/in_process_context_factory.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/dpi.h" |
23 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
24 #include "ui/gl/gl_surface.h" | 25 #include "ui/gl/gl_surface.h" |
25 | 26 |
26 #if defined(USE_X11) | 27 #if defined(USE_X11) |
27 #include "ui/gfx/x/x11_connection.h" | 28 #include "ui/gfx/x/x11_connection.h" |
28 #endif | 29 #endif |
29 | 30 |
30 #if defined(OS_WIN) | |
31 #include "ui/gfx/win/dpi.h" | |
32 #endif | |
33 | |
34 namespace { | 31 namespace { |
35 | 32 |
36 // Trivial WindowDelegate implementation that draws a colored background. | 33 // Trivial WindowDelegate implementation that draws a colored background. |
37 class DemoWindowDelegate : public aura::WindowDelegate { | 34 class DemoWindowDelegate : public aura::WindowDelegate { |
38 public: | 35 public: |
39 explicit DemoWindowDelegate(SkColor color) : color_(color) {} | 36 explicit DemoWindowDelegate(SkColor color) : color_(color) {} |
40 | 37 |
41 // Overridden from WindowDelegate: | 38 // Overridden from WindowDelegate: |
42 virtual gfx::Size GetMinimumSize() const override { | 39 virtual gfx::Size GetMinimumSize() const override { |
43 return gfx::Size(); | 40 return gfx::Size(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 106 |
110 int DemoMain() { | 107 int DemoMain() { |
111 #if defined(USE_X11) | 108 #if defined(USE_X11) |
112 // This demo uses InProcessContextFactory which uses X on a separate Gpu | 109 // This demo uses InProcessContextFactory which uses X on a separate Gpu |
113 // thread. | 110 // thread. |
114 gfx::InitializeThreadedX11(); | 111 gfx::InitializeThreadedX11(); |
115 #endif | 112 #endif |
116 | 113 |
117 gfx::GLSurface::InitializeOneOff(); | 114 gfx::GLSurface::InitializeOneOff(); |
118 | 115 |
119 #if defined(OS_WIN) | 116 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
120 gfx::InitDeviceScaleFactor(1.0f); | 117 gfx::InitDeviceScaleFactor(1.0f); |
121 #endif | 118 #endif |
122 | 119 |
123 // The ContextFactory must exist before any Compositors are created. | 120 // The ContextFactory must exist before any Compositors are created. |
124 scoped_ptr<ui::InProcessContextFactory> context_factory( | 121 scoped_ptr<ui::InProcessContextFactory> context_factory( |
125 new ui::InProcessContextFactory()); | 122 new ui::InProcessContextFactory()); |
126 | 123 |
127 // Create the message-loop here before creating the root window. | 124 // Create the message-loop here before creating the root window. |
128 base::MessageLoopForUI message_loop; | 125 base::MessageLoopForUI message_loop; |
129 | 126 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 int main(int argc, char** argv) { | 172 int main(int argc, char** argv) { |
176 CommandLine::Init(argc, argv); | 173 CommandLine::Init(argc, argv); |
177 | 174 |
178 // The exit manager is in charge of calling the dtors of singleton objects. | 175 // The exit manager is in charge of calling the dtors of singleton objects. |
179 base::AtExitManager exit_manager; | 176 base::AtExitManager exit_manager; |
180 | 177 |
181 base::i18n::InitializeICU(); | 178 base::i18n::InitializeICU(); |
182 | 179 |
183 return DemoMain(); | 180 return DemoMain(); |
184 } | 181 } |
OLD | NEW |