Suppress sending mousedown / mouseup when in fling
[chromium-blink-merge.git] / content / browser / renderer_host / overscroll_configuration.cc
blob16733a46a9a63dd7b96b8f31630ed020df07b6c1
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
3 // found in the LICENSE file.
5 #include "content/public/browser/overscroll_configuration.h"
7 #include "base/logging.h"
9 namespace {
11 float g_horiz_threshold_complete = 0.25f;
12 float g_vert_threshold_complete = 0.20f;
14 float g_min_threshold_start = 30.f;
16 float g_horiz_resist_after = 30.f;
17 float g_vert_resist_after = 30.f;
21 namespace content {
23 void SetOverscrollConfig(OverscrollConfig config, float value) {
24 switch (config) {
25 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE:
26 g_horiz_threshold_complete = value;
27 break;
29 case OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE:
30 g_vert_threshold_complete = value;
31 break;
33 case OVERSCROLL_CONFIG_MIN_THRESHOLD_START:
34 g_min_threshold_start = value;
35 break;
37 case OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER:
38 g_horiz_resist_after = value;
39 break;
41 case OVERSCROLL_CONFIG_VERT_RESIST_AFTER:
42 g_vert_resist_after = value;
43 break;
45 case OVERSCROLL_CONFIG_NONE:
46 case OVERSCROLL_CONFIG_COUNT:
47 NOTREACHED();
51 float GetOverscrollConfig(OverscrollConfig config) {
52 switch (config) {
53 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE:
54 return g_horiz_threshold_complete;
56 case OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE:
57 return g_vert_threshold_complete;
59 case OVERSCROLL_CONFIG_MIN_THRESHOLD_START:
60 return g_min_threshold_start;
62 case OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER:
63 return g_horiz_resist_after;
65 case OVERSCROLL_CONFIG_VERT_RESIST_AFTER:
66 return g_vert_resist_after;
68 case OVERSCROLL_CONFIG_NONE:
69 case OVERSCROLL_CONFIG_COUNT:
70 NOTREACHED();
73 return -1.f;
76 } // namespace content