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 "content/browser/renderer_host/tap_suppression_controller.h" | 5 #include "content/browser/renderer_host/tap_suppression_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 10 #include "content/browser/renderer_host/render_widget_host_impl.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 return false; | 116 return false; |
117 } | 117 } |
118 | 118 |
119 void TapSuppressionController::GestureFlingCancelAck(bool processed) { | 119 void TapSuppressionController::GestureFlingCancelAck(bool processed) { |
120 switch (state_) { | 120 switch (state_) { |
121 case NOTHING: | 121 case NOTHING: |
122 NOTREACHED() << "GFC_Ack without a GFC"; | 122 NOTREACHED() << "GFC_Ack without a GFC"; |
123 break; | 123 break; |
124 case GFC_IN_PROGRESS: | 124 case GFC_IN_PROGRESS: |
125 if (processed) | 125 if (processed) |
126 state_ = LAST_CANCEL_STOPPED_FLING; | 126 fling_cancel_time_ = base::TimeTicks::Now(); |
127 else | 127 state_ = LAST_CANCEL_STOPPED_FLING; |
128 state_ = NOTHING; | |
129 break; | 128 break; |
130 case MD_STASHED: | 129 case MD_STASHED: |
131 if (!processed) { | 130 if (!processed) { |
132 mouse_down_timer_.Stop(); | 131 mouse_down_timer_.Stop(); |
133 render_widget_host_->ForwardMouseEvent(stashed_mouse_down_); | 132 render_widget_host_->ForwardMouseEvent(stashed_mouse_down_); |
134 state_ = NOTHING; | 133 state_ = NOTHING; |
135 } // Else waiting for the timer to release the mouse event. | 134 } // Else waiting for the timer to release the mouse event. |
136 break; | 135 break; |
137 case LAST_CANCEL_STOPPED_FLING: | 136 case LAST_CANCEL_STOPPED_FLING: |
138 break; | 137 break; |
139 } | 138 } |
140 } | 139 } |
141 | 140 |
142 void TapSuppressionController::GestureFlingCancel(double cancel_time) { | 141 void TapSuppressionController::GestureFlingCancel(double cancel_time) { |
143 switch (state_) { | 142 switch (state_) { |
144 case NOTHING: | 143 case NOTHING: |
145 case GFC_IN_PROGRESS: | 144 case GFC_IN_PROGRESS: |
146 case LAST_CANCEL_STOPPED_FLING: | 145 case LAST_CANCEL_STOPPED_FLING: |
147 fling_cancel_time_ = base::TimeTicks::Now(); | |
148 state_ = GFC_IN_PROGRESS; | 146 state_ = GFC_IN_PROGRESS; |
149 break; | 147 break; |
150 case MD_STASHED: | 148 case MD_STASHED: |
151 break; | 149 break; |
152 } | 150 } |
153 } | 151 } |
154 | 152 |
155 void TapSuppressionController::MouseDownTimerExpired() { | 153 void TapSuppressionController::MouseDownTimerExpired() { |
156 switch (state_) { | 154 switch (state_) { |
157 case NOTHING: | 155 case NOTHING: |
158 case GFC_IN_PROGRESS: | 156 case GFC_IN_PROGRESS: |
159 case LAST_CANCEL_STOPPED_FLING: | 157 case LAST_CANCEL_STOPPED_FLING: |
160 NOTREACHED() << "Timer fired on invalid state."; | 158 NOTREACHED() << "Timer fired on invalid state."; |
161 state_ = NOTHING; | 159 state_ = NOTHING; |
162 break; | 160 break; |
163 case MD_STASHED: | 161 case MD_STASHED: |
164 render_widget_host_->ForwardMouseEvent(stashed_mouse_down_); | 162 render_widget_host_->ForwardMouseEvent(stashed_mouse_down_); |
165 state_ = NOTHING; | 163 state_ = NOTHING; |
166 break; | 164 break; |
167 } | 165 } |
168 } | 166 } |
169 | 167 |
170 } // namespace content. | 168 } // namespace content. |
OLD | NEW |