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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 24 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
25 const gfx::Rect& new_bounds) OVERRIDE; | 25 const gfx::Rect& new_bounds) OVERRIDE; |
26 virtual void OnFocus() OVERRIDE; | 26 virtual void OnFocus() OVERRIDE; |
27 virtual void OnBlur() OVERRIDE; | 27 virtual void OnBlur() OVERRIDE; |
28 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; | 28 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; |
29 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; | 29 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; |
30 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | 30 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; |
31 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; | 31 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; |
32 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE; | 32 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE; |
33 virtual bool CanFocus() OVERRIDE; | 33 virtual bool CanFocus() OVERRIDE; |
| 34 virtual bool ShouldActivate(Event* event) OVERRIDE; |
| 35 virtual void OnActivated() OVERRIDE; |
| 36 virtual void OnLostActive() OVERRIDE; |
34 virtual void OnCaptureLost() OVERRIDE; | 37 virtual void OnCaptureLost() OVERRIDE; |
35 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 38 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
36 virtual void OnWindowDestroying() OVERRIDE; | 39 virtual void OnWindowDestroying() OVERRIDE; |
37 virtual void OnWindowDestroyed() OVERRIDE; | 40 virtual void OnWindowDestroyed() OVERRIDE; |
38 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; | 41 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; |
39 | 42 |
40 private: | 43 private: |
41 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); | 44 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); |
42 }; | 45 }; |
43 | 46 |
(...skipping 11 matching lines...) Expand all Loading... |
55 virtual void OnWindowDestroyed() OVERRIDE; | 58 virtual void OnWindowDestroyed() OVERRIDE; |
56 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 59 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
57 | 60 |
58 private: | 61 private: |
59 SkColor color_; | 62 SkColor color_; |
60 ui::KeyboardCode last_key_code_; | 63 ui::KeyboardCode last_key_code_; |
61 | 64 |
62 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); | 65 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); |
63 }; | 66 }; |
64 | 67 |
| 68 class ActivateWindowDelegate : public TestWindowDelegate { |
| 69 public: |
| 70 ActivateWindowDelegate(); |
| 71 explicit ActivateWindowDelegate(bool activate); |
| 72 |
| 73 void set_activate(bool v) { activate_ = v; } |
| 74 int activated_count() const { return activated_count_; } |
| 75 int lost_active_count() const { return lost_active_count_; } |
| 76 int should_activate_count() const { return should_activate_count_; } |
| 77 void Clear() { |
| 78 activated_count_ = lost_active_count_ = should_activate_count_ = 0; |
| 79 } |
| 80 |
| 81 // Overridden from TestWindowDelegate: |
| 82 virtual bool ShouldActivate(Event* event) OVERRIDE; |
| 83 virtual void OnActivated() OVERRIDE; |
| 84 virtual void OnLostActive() OVERRIDE; |
| 85 |
| 86 private: |
| 87 bool activate_; |
| 88 int activated_count_; |
| 89 int lost_active_count_; |
| 90 int should_activate_count_; |
| 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(ActivateWindowDelegate); |
| 93 }; |
| 94 |
65 } // namespace test | 95 } // namespace test |
66 } // namespace aura | 96 } // namespace aura |
67 | 97 |
68 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 98 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
OLD | NEW |