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"
11 float g_horiz_threshold_complete
= 0.25f
;
12 float g_vert_threshold_complete
= 0.20f
;
14 float g_horiz_threshold_start_touchscreen
= 50.f
;
15 float g_horiz_threshold_start_touchpad
= 50.f
;
16 float g_vert_threshold_start
= 0.f
;
18 float g_horiz_resist_after
= 30.f
;
19 float g_vert_resist_after
= 30.f
;
25 void SetOverscrollConfig(OverscrollConfig config
, float value
) {
27 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE
:
28 g_horiz_threshold_complete
= value
;
31 case OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE
:
32 g_vert_threshold_complete
= value
;
35 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHSCREEN
:
36 g_horiz_threshold_start_touchscreen
= value
;
39 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHPAD
:
40 g_horiz_threshold_start_touchpad
= value
;
43 case OVERSCROLL_CONFIG_VERT_THRESHOLD_START
:
44 g_vert_threshold_start
= value
;
47 case OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER
:
48 g_horiz_resist_after
= value
;
51 case OVERSCROLL_CONFIG_VERT_RESIST_AFTER
:
52 g_vert_resist_after
= value
;
55 case OVERSCROLL_CONFIG_NONE
:
56 case OVERSCROLL_CONFIG_COUNT
:
61 float GetOverscrollConfig(OverscrollConfig config
) {
63 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE
:
64 return g_horiz_threshold_complete
;
66 case OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE
:
67 return g_vert_threshold_complete
;
69 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHSCREEN
:
70 return g_horiz_threshold_start_touchscreen
;
72 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START_TOUCHPAD
:
73 return g_horiz_threshold_start_touchpad
;
75 case OVERSCROLL_CONFIG_VERT_THRESHOLD_START
:
76 return g_vert_threshold_start
;
78 case OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER
:
79 return g_horiz_resist_after
;
81 case OVERSCROLL_CONFIG_VERT_RESIST_AFTER
:
82 return g_vert_resist_after
;
84 case OVERSCROLL_CONFIG_NONE
:
85 case OVERSCROLL_CONFIG_COUNT
:
92 } // namespace content