| 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 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 | 32 |
| 33 void set_minimum_size(const gfx::Size& minimum_size) { | 33 void set_minimum_size(const gfx::Size& minimum_size) { |
| 34 minimum_size_ = minimum_size; | 34 minimum_size_ = minimum_size; |
| 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. |
| 42 void set_can_focus(bool can_focus) { can_focus_ = can_focus; } |
| 43 |
| 41 // Overridden from WindowDelegate: | 44 // Overridden from WindowDelegate: |
| 42 virtual gfx::Size GetMinimumSize() const OVERRIDE; | 45 virtual gfx::Size GetMinimumSize() const OVERRIDE; |
| 43 virtual gfx::Size GetMaximumSize() const OVERRIDE; | 46 virtual gfx::Size GetMaximumSize() const OVERRIDE; |
| 44 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, | 47 virtual void OnBoundsChanged(const gfx::Rect& old_bounds, |
| 45 const gfx::Rect& new_bounds) OVERRIDE; | 48 const gfx::Rect& new_bounds) OVERRIDE; |
| 46 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; | 49 virtual gfx::NativeCursor GetCursor(const gfx::Point& point) OVERRIDE; |
| 47 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; | 50 virtual int GetNonClientComponent(const gfx::Point& point) const OVERRIDE; |
| 48 virtual bool ShouldDescendIntoChildForEventHandling( | 51 virtual bool ShouldDescendIntoChildForEventHandling( |
| 49 Window* child, | 52 Window* child, |
| 50 const gfx::Point& location) OVERRIDE; | 53 const gfx::Point& location) OVERRIDE; |
| 51 virtual bool CanFocus() OVERRIDE; | 54 virtual bool CanFocus() OVERRIDE; |
| 52 virtual void OnCaptureLost() OVERRIDE; | 55 virtual void OnCaptureLost() OVERRIDE; |
| 53 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 56 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 54 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; | 57 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; |
| 55 virtual void OnWindowDestroying() OVERRIDE; | 58 virtual void OnWindowDestroying() OVERRIDE; |
| 56 virtual void OnWindowDestroyed() OVERRIDE; | 59 virtual void OnWindowDestroyed() OVERRIDE; |
| 57 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; | 60 virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; |
| 58 virtual bool HasHitTestMask() const OVERRIDE; | 61 virtual bool HasHitTestMask() const OVERRIDE; |
| 59 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; | 62 virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; |
| 60 virtual scoped_refptr<ui::Texture> CopyTexture() OVERRIDE; | 63 virtual scoped_refptr<ui::Texture> CopyTexture() OVERRIDE; |
| 61 | 64 |
| 62 private: | 65 private: |
| 63 int window_component_; | 66 int window_component_; |
| 64 bool delete_on_destroyed_; | 67 bool delete_on_destroyed_; |
| 65 gfx::Size minimum_size_; | 68 gfx::Size minimum_size_; |
| 66 gfx::Size maximum_size_; | 69 gfx::Size maximum_size_; |
| 70 bool can_focus_; |
| 67 | 71 |
| 68 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); | 72 DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate); |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 // A simple WindowDelegate implementation for these tests. It owns itself | 75 // A simple WindowDelegate implementation for these tests. It owns itself |
| 72 // (deletes itself when the Window it is attached to is destroyed). | 76 // (deletes itself when the Window it is attached to is destroyed). |
| 73 class ColorTestWindowDelegate : public TestWindowDelegate { | 77 class ColorTestWindowDelegate : public TestWindowDelegate { |
| 74 public: | 78 public: |
| 75 explicit ColorTestWindowDelegate(SkColor color); | 79 explicit ColorTestWindowDelegate(SkColor color); |
| 76 virtual ~ColorTestWindowDelegate(); | 80 virtual ~ColorTestWindowDelegate(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 int key_press_count_; | 138 int key_press_count_; |
| 135 int key_release_count_; | 139 int key_release_count_; |
| 136 | 140 |
| 137 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); | 141 DISALLOW_COPY_AND_ASSIGN(EventCountDelegate); |
| 138 }; | 142 }; |
| 139 | 143 |
| 140 } // namespace test | 144 } // namespace test |
| 141 } // namespace aura | 145 } // namespace aura |
| 142 | 146 |
| 143 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ | 147 #endif // UI_AURA_TEST_TEST_WINDOW_DELEGATE_H_ |
| OLD | NEW |