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/event.h" | |
14 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
15 #include "ui/aura/single_display_manager.h" | 14 #include "ui/aura/single_display_manager.h" |
16 #include "ui/aura/shared/root_window_capture_client.h" | 15 #include "ui/aura/shared/root_window_capture_client.h" |
17 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
18 #include "ui/aura/window_delegate.h" | 17 #include "ui/aura/window_delegate.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 namespace { | 30 namespace { |
31 | 31 |
32 // Trivial WindowDelegate implementation that draws a colored background. | 32 // Trivial WindowDelegate implementation that draws a colored background. |
33 class DemoWindowDelegate : public aura::WindowDelegate { | 33 class DemoWindowDelegate : public aura::WindowDelegate { |
34 public: | 34 public: |
35 explicit DemoWindowDelegate(SkColor color) : color_(color) {} | 35 explicit DemoWindowDelegate(SkColor color) : color_(color) {} |
36 | 36 |
37 // Overridden from WindowDelegate: | 37 // Overridden from WindowDelegate: |
38 virtual gfx::Size GetMinimumSize() const OVERRIDE { | 38 virtual gfx::Size GetMinimumSize() const OVERRIDE { |
39 return gfx::Size(); | 39 return gfx::Size(); |
40 } | 40 } |
41 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 41 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
42 const gfx::Rect& new_bounds) OVERRIDE {} | 42 const gfx::Rect& new_bounds) OVERRIDE {} |
43 virtual void OnFocus(aura::Window* old_focused_window) OVERRIDE {} | 43 virtual void OnFocus(aura::Window* old_focused_window) OVERRIDE {} |
44 virtual void OnBlur() OVERRIDE {} | 44 virtual void OnBlur() OVERRIDE {} |
45 virtual bool OnKeyEvent(aura::KeyEvent* event) OVERRIDE { | 45 virtual bool OnKeyEvent(ui::KeyEvent* event) OVERRIDE { |
46 return false; | 46 return false; |
47 } | 47 } |
48 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { | 48 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE { |
49 return gfx::kNullCursor; | 49 return gfx::kNullCursor; |
50 } | 50 } |
51 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { | 51 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE { |
52 return HTCAPTION; | 52 return HTCAPTION; |
53 } | 53 } |
54 virtual bool ShouldDescendIntoChildForEventHandling( | 54 virtual bool ShouldDescendIntoChildForEventHandling( |
55 aura::Window* child, | 55 aura::Window* child, |
56 const gfx::Point& location) OVERRIDE { | 56 const gfx::Point& location) OVERRIDE { |
57 return true; | 57 return true; |
58 } | 58 } |
59 virtual bool OnMouseEvent(aura::MouseEvent* event) OVERRIDE { | 59 virtual bool OnMouseEvent(ui::MouseEvent* event) OVERRIDE { |
60 return true; | 60 return true; |
61 } | 61 } |
62 virtual ui::TouchStatus OnTouchEvent(aura::TouchEvent* event) OVERRIDE { | 62 virtual ui::TouchStatus OnTouchEvent(ui::TouchEventImpl* event) OVERRIDE { |
63 return ui::TOUCH_STATUS_END; | 63 return ui::TOUCH_STATUS_END; |
64 } | 64 } |
65 virtual ui::GestureStatus OnGestureEvent(aura::GestureEvent* event) OVERRIDE { | 65 virtual ui::GestureStatus OnGestureEvent( |
| 66 ui::GestureEventImpl* event) OVERRIDE { |
66 return ui::GESTURE_STATUS_UNKNOWN; | 67 return ui::GESTURE_STATUS_UNKNOWN; |
67 } | 68 } |
68 virtual bool CanFocus() OVERRIDE { return true; } | 69 virtual bool CanFocus() OVERRIDE { return true; } |
69 virtual void OnCaptureLost() OVERRIDE {} | 70 virtual void OnCaptureLost() OVERRIDE {} |
70 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 71 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
71 canvas->DrawColor(color_, SkXfermode::kSrc_Mode); | 72 canvas->DrawColor(color_, SkXfermode::kSrc_Mode); |
72 } | 73 } |
73 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} | 74 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE {} |
74 virtual void OnWindowDestroying() OVERRIDE {} | 75 virtual void OnWindowDestroying() OVERRIDE {} |
75 virtual void OnWindowDestroyed() OVERRIDE {} | 76 virtual void OnWindowDestroyed() OVERRIDE {} |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 window3.Show(); | 160 window3.Show(); |
160 window3.SetParent(&window2); | 161 window3.SetParent(&window2); |
161 | 162 |
162 root_window->ShowRootWindow(); | 163 root_window->ShowRootWindow(); |
163 MessageLoopForUI::current()->Run(); | 164 MessageLoopForUI::current()->Run(); |
164 | 165 |
165 ui::CompositorTestSupport::Terminate(); | 166 ui::CompositorTestSupport::Terminate(); |
166 | 167 |
167 return 0; | 168 return 0; |
168 } | 169 } |
OLD | NEW |