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