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 #ifndef UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 5 #ifndef UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
6 #define UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 6 #define UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 void set_maximum_size(const gfx::Size& maximum_size) { | 37 void set_maximum_size(const gfx::Size& maximum_size) { |
38 maximum_size_ = maximum_size; | 38 maximum_size_ = maximum_size; |
39 } | 39 } |
40 | 40 |
41 // Sets the return value for CanFocus(). Default is true. | 41 // Sets the return value for CanFocus(). Default is true. |
42 void set_can_focus(bool can_focus) { can_focus_ = can_focus; } | 42 void set_can_focus(bool can_focus) { can_focus_ = can_focus; } |
43 | 43 |
44 // Overridden from WindowDelegate: | 44 // Overridden from WindowDelegate: |
45 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 45 virtual gfx::Size GetMinimumSize() const override; |
46 virtual gfx::Size GetMaximumSize() const OVERRIDE; | 46 virtual gfx::Size GetMaximumSize() const override; |
47 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 47 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
48 const gfx::Rect& new_bounds) OVERRIDE; | 48 const gfx::Rect& new_bounds) override; |
49 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; | 49 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) override; |
50 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | 50 virtual int GetNonClientComponent(const gfx::Point& point) const override; |
51 virtual bool ShouldDescendIntoChildForEventHandling( | 51 virtual bool ShouldDescendIntoChildForEventHandling( |
52 Window* child, | 52 Window* child, |
53 const gfx::Point& location) OVERRIDE; | 53 const gfx::Point& location) override; |
54 virtual bool CanFocus() OVERRIDE; | 54 virtual bool CanFocus() override; |
55 virtual void OnCaptureLost() OVERRIDE; | 55 virtual void OnCaptureLost() override; |
56 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 56 virtual void OnPaint(gfx::Canvas* canvas) override; |
57 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 57 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
58 virtual void OnWindowDestroying(Window* window) OVERRIDE; | 58 virtual void OnWindowDestroying(Window* window) override; |
59 virtual void OnWindowDestroyed(Window* window) OVERRIDE; | 59 virtual void OnWindowDestroyed(Window* window) override; |
60 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; | 60 virtual void OnWindowTargetVisibilityChanged(bool visible) override; |
61 virtual bool HasHitTestMask() const OVERRIDE; | 61 virtual bool HasHitTestMask() const override; |
62 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; | 62 virtual void GetHitTestMask(gfx::Path* mask) const override; |
63 | 63 |
64 private: | 64 private: |
65 int window_component_; | 65 int window_component_; |
66 bool delete_on_destroyed_; | 66 bool delete_on_destroyed_; |
67 gfx::Size minimum_size_; | 67 gfx::Size minimum_size_; |
68 gfx::Size maximum_size_; | 68 gfx::Size maximum_size_; |
69 bool can_focus_; | 69 bool can_focus_; |
70 | 70 |
71 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); | 71 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); |
72 }; | 72 }; |
73 | 73 |
74 // A simple WindowDelegate implementation for these tests. It owns itself | 74 // A simple WindowDelegate implementation for these tests. It owns itself |
75 // (deletes itself when the Window it is attached to is destroyed). | 75 // (deletes itself when the Window it is attached to is destroyed). |
76 class ColorTestWindowDelegate : public TestWindowDelegate { | 76 class ColorTestWindowDelegate : public TestWindowDelegate { |
77 public: | 77 public: |
78 explicit ColorTestWindowDelegate(SkColor color); | 78 explicit ColorTestWindowDelegate(SkColor color); |
79 virtual ~ColorTestWindowDelegate(); | 79 virtual ~ColorTestWindowDelegate(); |
80 | 80 |
81 ui::KeyboardCode last_key_code() const { return last_key_code_; } | 81 ui::KeyboardCode last_key_code() const { return last_key_code_; } |
82 | 82 |
83 // Overridden from TestWindowDelegate: | 83 // Overridden from TestWindowDelegate: |
84 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 84 virtual void OnKeyEvent(ui::KeyEvent* event) override; |
85 virtual void OnWindowDestroyed(Window* window) OVERRIDE; | 85 virtual void OnWindowDestroyed(Window* window) override; |
86 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 86 virtual void OnPaint(gfx::Canvas* canvas) override; |
87 | 87 |
88 private: | 88 private: |
89 SkColor color_; | 89 SkColor color_; |
90 ui::KeyboardCode last_key_code_; | 90 ui::KeyboardCode last_key_code_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); | 92 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); |
93 }; | 93 }; |
94 | 94 |
95 // A simple WindowDelegate that has a hit-test mask. | 95 // A simple WindowDelegate that has a hit-test mask. |
96 class MaskedWindowDelegate : public TestWindowDelegate { | 96 class MaskedWindowDelegate : public TestWindowDelegate { |
97 public: | 97 public: |
98 explicit MaskedWindowDelegate(const gfx::Rect mask_rect); | 98 explicit MaskedWindowDelegate(const gfx::Rect mask_rect); |
99 | 99 |
100 // Overridden from TestWindowDelegate: | 100 // Overridden from TestWindowDelegate: |
101 virtual bool HasHitTestMask() const OVERRIDE; | 101 virtual bool HasHitTestMask() const override; |
102 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; | 102 virtual void GetHitTestMask(gfx::Path* mask) const override; |
103 | 103 |
104 private: | 104 private: |
105 gfx::Rect mask_rect_; | 105 gfx::Rect mask_rect_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(MaskedWindowDelegate); | 107 DISALLOW_COPY_AND_ASSIGN(MaskedWindowDelegate); |
108 }; | 108 }; |
109 | 109 |
110 // Keeps track of mouse/key events. | 110 // Keeps track of mouse/key events. |
111 class EventCountDelegate : public TestWindowDelegate { | 111 class EventCountDelegate : public TestWindowDelegate { |
112 public: | 112 public: |
113 EventCountDelegate(); | 113 EventCountDelegate(); |
114 | 114 |
115 // Overridden from TestWindowDelegate: | 115 // Overridden from TestWindowDelegate: |
116 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 116 virtual void OnKeyEvent(ui::KeyEvent* event) override; |
117 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 117 virtual void OnMouseEvent(ui::MouseEvent* event) override; |
118 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 118 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
119 | 119 |
120 // Returns the counts of mouse motion events in the | 120 // Returns the counts of mouse motion events in the |
121 // form of "<enter> <move> <leave>". | 121 // form of "<enter> <move> <leave>". |
122 std::string GetMouseMotionCountsAndReset(); | 122 std::string GetMouseMotionCountsAndReset(); |
123 | 123 |
124 // Returns the counts of mouse button events in the | 124 // Returns the counts of mouse button events in the |
125 // form of "<press> <release>". | 125 // form of "<press> <release>". |
126 std::string GetMouseButtonCountsAndReset(); | 126 std::string GetMouseButtonCountsAndReset(); |
127 | 127 |
128 // Returns the counts of key events in the form of | 128 // Returns the counts of key events in the form of |
(...skipping 13 matching lines...) Expand all Loading... |
142 int key_release_count_; | 142 int key_release_count_; |
143 int gesture_count_; | 143 int gesture_count_; |
144 | 144 |
145 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); | 145 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); |
146 }; | 146 }; |
147 | 147 |
148 } // namespace test | 148 } // namespace test |
149 } // namespace aura | 149 } // namespace aura |
150 | 150 |
151 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 151 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
OLD | NEW |