| 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 #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" |
| 11 #include "ui/aura/window_delegate.h" | 11 #include "ui/aura/window_delegate.h" |
| 12 | 12 |
| 13 namespace aura { | 13 namespace aura { |
| 14 namespace test { | 14 namespace test { |
| 15 | 15 |
| 16 // WindowDelegate implementation with all methods stubbed out. | 16 // WindowDelegate implementation with all methods stubbed out. |
| 17 class TestWindowDelegate : public WindowDelegate { | 17 class TestWindowDelegate : public WindowDelegate { |
| 18 public: | 18 public: |
| 19 TestWindowDelegate(); | 19 TestWindowDelegate(); |
| 20 virtual ~TestWindowDelegate(); | 20 virtual ~TestWindowDelegate(); |
| 21 | 21 |
| 22 void set_window_component(int window_component) { |
| 23 window_component_ = window_component; |
| 24 } |
| 25 |
| 22 // Overridden from WindowDelegate: | 26 // Overridden from WindowDelegate: |
| 23 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 27 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
| 24 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 28 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 25 const gfx::Rect& new_bounds) OVERRIDE; | 29 const gfx::Rect& new_bounds) OVERRIDE; |
| 26 virtual void OnFocus() OVERRIDE; | 30 virtual void OnFocus() OVERRIDE; |
| 27 virtual void OnBlur() OVERRIDE; | 31 virtual void OnBlur() OVERRIDE; |
| 28 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; | 32 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; |
| 29 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; | 33 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; |
| 30 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | 34 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; |
| 31 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; | 35 virtual bool OnMouseEvent(MouseEvent* event) OVERRIDE; |
| 32 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE; | 36 virtual ui::TouchStatus OnTouchEvent(TouchEvent* event) OVERRIDE; |
| 33 virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE; | 37 virtual ui::GestureStatus OnGestureEvent(GestureEvent* event) OVERRIDE; |
| 34 virtual bool CanFocus() OVERRIDE; | 38 virtual bool CanFocus() OVERRIDE; |
| 35 virtual void OnCaptureLost() OVERRIDE; | 39 virtual void OnCaptureLost() OVERRIDE; |
| 36 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 40 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 37 virtual void OnWindowDestroying() OVERRIDE; | 41 virtual void OnWindowDestroying() OVERRIDE; |
| 38 virtual void OnWindowDestroyed() OVERRIDE; | 42 virtual void OnWindowDestroyed() OVERRIDE; |
| 39 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; | 43 virtual void OnWindowVisibilityChanged(bool visible) OVERRIDE; |
| 40 | 44 |
| 41 private: | 45 private: |
| 46 int window_component_; |
| 47 |
| 42 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); | 48 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); |
| 43 }; | 49 }; |
| 44 | 50 |
| 45 // A simple WindowDelegate implementation for these tests. It owns itself | 51 // A simple WindowDelegate implementation for these tests. It owns itself |
| 46 // (deletes itself when the Window it is attached to is destroyed). | 52 // (deletes itself when the Window it is attached to is destroyed). |
| 47 class ColorTestWindowDelegate : public TestWindowDelegate { | 53 class ColorTestWindowDelegate : public TestWindowDelegate { |
| 48 public: | 54 public: |
| 49 explicit ColorTestWindowDelegate(SkColor color); | 55 explicit ColorTestWindowDelegate(SkColor color); |
| 50 virtual ~ColorTestWindowDelegate(); | 56 virtual ~ColorTestWindowDelegate(); |
| 51 | 57 |
| 52 ui::KeyboardCode last_key_code() const { return last_key_code_; } | 58 ui::KeyboardCode last_key_code() const { return last_key_code_; } |
| 53 | 59 |
| 54 // Overridden from TestWindowDelegate: | 60 // Overridden from TestWindowDelegate: |
| 55 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; | 61 virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE; |
| 56 virtual void OnWindowDestroyed() OVERRIDE; | 62 virtual void OnWindowDestroyed() OVERRIDE; |
| 57 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 63 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 58 | 64 |
| 59 private: | 65 private: |
| 60 SkColor color_; | 66 SkColor color_; |
| 61 ui::KeyboardCode last_key_code_; | 67 ui::KeyboardCode last_key_code_; |
| 62 | 68 |
| 63 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); | 69 DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate); |
| 64 }; | 70 }; |
| 65 | 71 |
| 66 } // namespace test | 72 } // namespace test |
| 67 } // namespace aura | 73 } // namespace aura |
| 68 | 74 |
| 69 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 75 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
| OLD | NEW |