OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/draggable_button.h" | 5 #import "chrome/browser/ui/cocoa/draggable_button.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "base/mac/scoped_nsobject.h" | |
11 | |
12 namespace { | |
13 | 10 |
14 // Code taken from <http://codereview.chromium.org/180036/diff/3001/3004>. | 11 // Code taken from <http://codereview.chromium.org/180036/diff/3001/3004>. |
15 // TODO(viettrungluu): Do we want common, standard code for drag hysteresis? | 12 // TODO(viettrungluu): Do we want common, standard code for drag hysteresis? |
16 const CGFloat kWebDragStartHysteresisX = 5.0; | 13 const CGFloat kWebDragStartHysteresisX = 5.0; |
17 const CGFloat kWebDragStartHysteresisY = 5.0; | 14 const CGFloat kWebDragStartHysteresisY = 5.0; |
18 const CGFloat kDragExpirationTimeout = 0.45; | 15 const CGFloat kDragExpirationTimeout = 0.45; |
19 | 16 |
20 } | |
21 | |
22 // Private ///////////////////////////////////////////////////////////////////// | 17 // Private ///////////////////////////////////////////////////////////////////// |
23 | 18 |
24 @interface DraggableButtonImpl (Private) | 19 @interface DraggableButtonImpl (Private) |
25 | 20 |
26 - (BOOL)deltaIndicatesDragStartWithXDelta:(float)xDelta | 21 - (BOOL)deltaIndicatesDragStartWithXDelta:(float)xDelta |
27 yDelta:(float)yDelta | 22 yDelta:(float)yDelta |
28 xHysteresis:(float)xHysteresis | 23 xHysteresis:(float)xHysteresis |
29 yHysteresis:(float)yHysteresis; | 24 yHysteresis:(float)yHysteresis; |
30 - (BOOL)deltaIndicatesConclusionReachedWithXDelta:(float)xDelta | 25 - (BOOL)deltaIndicatesConclusionReachedWithXDelta:(float)xDelta |
31 yDelta:(float)yDelta | 26 yDelta:(float)yDelta |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 275 |
281 - (void)endDrag { | 276 - (void)endDrag { |
282 if ([button_ respondsToSelector:_cmd] && | 277 if ([button_ respondsToSelector:_cmd] && |
283 [button_ endDrag] != kDraggableButtonImplUseBase) { | 278 [button_ endDrag] != kDraggableButtonImplUseBase) { |
284 return; | 279 return; |
285 } | 280 } |
286 [button_ highlight:NO]; | 281 [button_ highlight:NO]; |
287 } | 282 } |
288 | 283 |
289 @end | 284 @end |
OLD | NEW |