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" |
11 #include "third_party/skia/include/core/SkColor.h" | 11 #include "third_party/skia/include/core/SkColor.h" |
12 #include "ui/aura/window_delegate.h" | 12 #include "ui/aura/window_delegate.h" |
| 13 #include "ui/base/ime/dummy_text_input_client.h" |
13 #include "ui/events/keycodes/keyboard_codes.h" | 14 #include "ui/events/keycodes/keyboard_codes.h" |
14 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
15 | 16 |
16 namespace aura { | 17 namespace aura { |
17 namespace test { | 18 namespace test { |
18 | 19 |
19 // WindowDelegate implementation with all methods stubbed out. | 20 // WindowDelegate implementation with all methods stubbed out. |
20 class TestWindowDelegate : public WindowDelegate { | 21 class TestWindowDelegate : public WindowDelegate { |
21 public: | 22 public: |
22 TestWindowDelegate(); | 23 TestWindowDelegate(); |
(...skipping 16 matching lines...) Expand all Loading... |
39 } | 40 } |
40 | 41 |
41 // Sets the return value for CanFocus(). Default is true. | 42 // Sets the return value for CanFocus(). Default is true. |
42 void set_can_focus(bool can_focus) { can_focus_ = can_focus; } | 43 void set_can_focus(bool can_focus) { can_focus_ = can_focus; } |
43 | 44 |
44 // Overridden from WindowDelegate: | 45 // Overridden from WindowDelegate: |
45 gfx::Size GetMinimumSize() const override; | 46 gfx::Size GetMinimumSize() const override; |
46 gfx::Size GetMaximumSize() const override; | 47 gfx::Size GetMaximumSize() const override; |
47 void OnBoundsChanged(const gfx::Rect& old_bounds, | 48 void OnBoundsChanged(const gfx::Rect& old_bounds, |
48 const gfx::Rect& new_bounds) override; | 49 const gfx::Rect& new_bounds) override; |
| 50 ui::TextInputClient* GetFocusedTextInputClient() override; |
49 gfx::NativeCursor GetCursor(const gfx::Point& point) override; | 51 gfx::NativeCursor GetCursor(const gfx::Point& point) override; |
50 int GetNonClientComponent(const gfx::Point& point) const override; | 52 int GetNonClientComponent(const gfx::Point& point) const override; |
51 bool ShouldDescendIntoChildForEventHandling( | 53 bool ShouldDescendIntoChildForEventHandling( |
52 Window* child, | 54 Window* child, |
53 const gfx::Point& location) override; | 55 const gfx::Point& location) override; |
54 bool CanFocus() override; | 56 bool CanFocus() override; |
55 void OnCaptureLost() override; | 57 void OnCaptureLost() override; |
56 void OnPaint(gfx::Canvas* canvas) override; | 58 void OnPaint(gfx::Canvas* canvas) override; |
57 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 59 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
58 void OnWindowDestroying(Window* window) override; | 60 void OnWindowDestroying(Window* window) override; |
59 void OnWindowDestroyed(Window* window) override; | 61 void OnWindowDestroyed(Window* window) override; |
60 void OnWindowTargetVisibilityChanged(bool visible) override; | 62 void OnWindowTargetVisibilityChanged(bool visible) override; |
61 bool HasHitTestMask() const override; | 63 bool HasHitTestMask() const override; |
62 void GetHitTestMask(gfx::Path* mask) const override; | 64 void GetHitTestMask(gfx::Path* mask) const override; |
63 | 65 |
64 private: | 66 private: |
65 int window_component_; | 67 int window_component_; |
66 bool delete_on_destroyed_; | 68 bool delete_on_destroyed_; |
67 gfx::Size minimum_size_; | 69 gfx::Size minimum_size_; |
68 gfx::Size maximum_size_; | 70 gfx::Size maximum_size_; |
| 71 ui::DummyTextInputClient text_input_client_; |
69 bool can_focus_; | 72 bool can_focus_; |
70 | 73 |
71 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); |
72 }; | 75 }; |
73 | 76 |
74 // A simple WindowDelegate implementation for these tests. It owns itself | 77 // A simple WindowDelegate implementation for these tests. It owns itself |
75 // (deletes itself when the Window it is attached to is destroyed). | 78 // (deletes itself when the Window it is attached to is destroyed). |
76 class ColorTestWindowDelegate : public TestWindowDelegate { | 79 class ColorTestWindowDelegate : public TestWindowDelegate { |
77 public: | 80 public: |
78 explicit ColorTestWindowDelegate(SkColor color); | 81 explicit ColorTestWindowDelegate(SkColor color); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 int key_release_count_; | 145 int key_release_count_; |
143 int gesture_count_; | 146 int gesture_count_; |
144 | 147 |
145 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); | 148 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); |
146 }; | 149 }; |
147 | 150 |
148 } // namespace test | 151 } // namespace test |
149 } // namespace aura | 152 } // namespace aura |
150 | 153 |
151 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 154 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
OLD | NEW |