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 #include "ash/wm/system_gesture_event_filter.h" | 5 #include "ash/wm/system_gesture_event_filter.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 namespace test { | 43 namespace test { |
44 | 44 |
45 namespace { | 45 namespace { |
46 | 46 |
47 class ResizableWidgetDelegate : public views::WidgetDelegateView { | 47 class ResizableWidgetDelegate : public views::WidgetDelegateView { |
48 public: | 48 public: |
49 ResizableWidgetDelegate() {} | 49 ResizableWidgetDelegate() {} |
50 virtual ~ResizableWidgetDelegate() {} | 50 virtual ~ResizableWidgetDelegate() {} |
51 | 51 |
52 private: | 52 private: |
53 virtual bool CanResize() const OVERRIDE { return true; } | 53 virtual bool CanResize() const override { return true; } |
54 virtual bool CanMaximize() const OVERRIDE { return true; } | 54 virtual bool CanMaximize() const override { return true; } |
55 virtual bool CanMinimize() const OVERRIDE { return true; } | 55 virtual bool CanMinimize() const override { return true; } |
56 virtual void DeleteDelegate() OVERRIDE { delete this; } | 56 virtual void DeleteDelegate() override { delete this; } |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(ResizableWidgetDelegate); | 58 DISALLOW_COPY_AND_ASSIGN(ResizableWidgetDelegate); |
59 }; | 59 }; |
60 | 60 |
61 // Support class for testing windows with a maximum size. | 61 // Support class for testing windows with a maximum size. |
62 class MaxSizeNCFV : public views::NonClientFrameView { | 62 class MaxSizeNCFV : public views::NonClientFrameView { |
63 public: | 63 public: |
64 MaxSizeNCFV() {} | 64 MaxSizeNCFV() {} |
65 private: | 65 private: |
66 virtual gfx::Size GetMaximumSize() const OVERRIDE { | 66 virtual gfx::Size GetMaximumSize() const override { |
67 return gfx::Size(200, 200); | 67 return gfx::Size(200, 200); |
68 } | 68 } |
69 virtual gfx::Rect GetBoundsForClientView() const OVERRIDE { | 69 virtual gfx::Rect GetBoundsForClientView() const override { |
70 return gfx::Rect(); | 70 return gfx::Rect(); |
71 }; | 71 }; |
72 | 72 |
73 virtual gfx::Rect GetWindowBoundsForClientBounds( | 73 virtual gfx::Rect GetWindowBoundsForClientBounds( |
74 const gfx::Rect& client_bounds) const OVERRIDE { | 74 const gfx::Rect& client_bounds) const override { |
75 return gfx::Rect(); | 75 return gfx::Rect(); |
76 }; | 76 }; |
77 | 77 |
78 // This function must ask the ClientView to do a hittest. We don't do this in | 78 // This function must ask the ClientView to do a hittest. We don't do this in |
79 // the parent NonClientView because that makes it more difficult to calculate | 79 // the parent NonClientView because that makes it more difficult to calculate |
80 // hittests for regions that are partially obscured by the ClientView, e.g. | 80 // hittests for regions that are partially obscured by the ClientView, e.g. |
81 // HTSYSMENU. | 81 // HTSYSMENU. |
82 virtual int NonClientHitTest(const gfx::Point& point) OVERRIDE { | 82 virtual int NonClientHitTest(const gfx::Point& point) override { |
83 return HTNOWHERE; | 83 return HTNOWHERE; |
84 } | 84 } |
85 virtual void GetWindowMask(const gfx::Size& size, | 85 virtual void GetWindowMask(const gfx::Size& size, |
86 gfx::Path* window_mask) OVERRIDE {} | 86 gfx::Path* window_mask) override {} |
87 virtual void ResetWindowControls() OVERRIDE {} | 87 virtual void ResetWindowControls() override {} |
88 virtual void UpdateWindowIcon() OVERRIDE {} | 88 virtual void UpdateWindowIcon() override {} |
89 virtual void UpdateWindowTitle() OVERRIDE {} | 89 virtual void UpdateWindowTitle() override {} |
90 virtual void SizeConstraintsChanged() OVERRIDE {} | 90 virtual void SizeConstraintsChanged() override {} |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(MaxSizeNCFV); | 92 DISALLOW_COPY_AND_ASSIGN(MaxSizeNCFV); |
93 }; | 93 }; |
94 | 94 |
95 class MaxSizeWidgetDelegate : public views::WidgetDelegateView { | 95 class MaxSizeWidgetDelegate : public views::WidgetDelegateView { |
96 public: | 96 public: |
97 MaxSizeWidgetDelegate() {} | 97 MaxSizeWidgetDelegate() {} |
98 virtual ~MaxSizeWidgetDelegate() {} | 98 virtual ~MaxSizeWidgetDelegate() {} |
99 | 99 |
100 private: | 100 private: |
101 virtual bool CanResize() const OVERRIDE { return true; } | 101 virtual bool CanResize() const override { return true; } |
102 virtual bool CanMaximize() const OVERRIDE { return false; } | 102 virtual bool CanMaximize() const override { return false; } |
103 virtual void DeleteDelegate() OVERRIDE { delete this; } | 103 virtual void DeleteDelegate() override { delete this; } |
104 virtual views::NonClientFrameView* CreateNonClientFrameView( | 104 virtual views::NonClientFrameView* CreateNonClientFrameView( |
105 views::Widget* widget) OVERRIDE { | 105 views::Widget* widget) override { |
106 return new MaxSizeNCFV; | 106 return new MaxSizeNCFV; |
107 } | 107 } |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(MaxSizeWidgetDelegate); | 109 DISALLOW_COPY_AND_ASSIGN(MaxSizeWidgetDelegate); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace | 112 } // namespace |
113 | 113 |
114 class SystemGestureEventFilterTest : public AshTestBase { | 114 class SystemGestureEventFilterTest : public AshTestBase { |
115 public: | 115 public: |
(...skipping 14 matching lines...) Expand all Loading... |
130 aura::Window* GetLongPressAffordanceTarget() { | 130 aura::Window* GetLongPressAffordanceTarget() { |
131 return GetLongPressAffordance()->tap_down_target_; | 131 return GetLongPressAffordance()->tap_down_target_; |
132 } | 132 } |
133 | 133 |
134 views::View* GetLongPressAffordanceView() { | 134 views::View* GetLongPressAffordanceView() { |
135 return reinterpret_cast<views::View*>( | 135 return reinterpret_cast<views::View*>( |
136 GetLongPressAffordance()->view_.get()); | 136 GetLongPressAffordance()->view_.get()); |
137 } | 137 } |
138 | 138 |
139 // Overridden from AshTestBase: | 139 // Overridden from AshTestBase: |
140 virtual void SetUp() OVERRIDE { | 140 virtual void SetUp() override { |
141 // TODO(jonross): TwoFingerDragDelayed() and ThreeFingerGestureStopsDrag() | 141 // TODO(jonross): TwoFingerDragDelayed() and ThreeFingerGestureStopsDrag() |
142 // both use hardcoded touch points, assuming that they target empty header | 142 // both use hardcoded touch points, assuming that they target empty header |
143 // space. Window control order now reflects configuration files and can | 143 // space. Window control order now reflects configuration files and can |
144 // change. The tests should be improved to dynamically decide touch points. | 144 // change. The tests should be improved to dynamically decide touch points. |
145 // To address this we specify the originally expected window control | 145 // To address this we specify the originally expected window control |
146 // positions to be consistent across tests. | 146 // positions to be consistent across tests. |
147 std::vector<views::FrameButton> leading; | 147 std::vector<views::FrameButton> leading; |
148 std::vector<views::FrameButton> trailing; | 148 std::vector<views::FrameButton> trailing; |
149 trailing.push_back(views::FRAME_BUTTON_MINIMIZE); | 149 trailing.push_back(views::FRAME_BUTTON_MINIMIZE); |
150 trailing.push_back(views::FRAME_BUTTON_MAXIMIZE); | 150 trailing.push_back(views::FRAME_BUTTON_MAXIMIZE); |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 for (int i = 1; i <= 3; ++i) | 596 for (int i = 1; i <= 3; ++i) |
597 GetEventGenerator().ReleaseTouchId(i); | 597 GetEventGenerator().ReleaseTouchId(i); |
598 EXPECT_EQ(event_handler.num_gesture_events(), | 598 EXPECT_EQ(event_handler.num_gesture_events(), |
599 delegate.GetGestureCountAndReset()); | 599 delegate.GetGestureCountAndReset()); |
600 | 600 |
601 aura::Env::GetInstance()->RemovePreTargetHandler(&event_handler); | 601 aura::Env::GetInstance()->RemovePreTargetHandler(&event_handler); |
602 } | 602 } |
603 | 603 |
604 } // namespace test | 604 } // namespace test |
605 } // namespace ash | 605 } // namespace ash |
OLD | NEW |