| 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/public/browser/overscroll_configuration.h" | 5 #include "content/public/browser/overscroll_configuration.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| 11 float g_horiz_threshold_complete = 0.25f; | 11 float g_horiz_threshold_complete = 0.25f; |
| 12 float g_vert_threshold_complete = 0.20f; | 12 float g_vert_threshold_complete = 0.20f; |
| 13 | 13 |
| 14 float g_min_threshold_start = 50.f; | 14 float g_horiz_threshold_start = 50.f; |
| 15 float g_vert_threshold_start = 0.f; |
| 15 | 16 |
| 16 float g_horiz_resist_after = 30.f; | 17 float g_horiz_resist_after = 30.f; |
| 17 float g_vert_resist_after = 30.f; | 18 float g_vert_resist_after = 30.f; |
| 18 | 19 |
| 19 } | 20 } |
| 20 | 21 |
| 21 namespace content { | 22 namespace content { |
| 22 | 23 |
| 23 void SetOverscrollConfig(OverscrollConfig config, float value) { | 24 void SetOverscrollConfig(OverscrollConfig config, float value) { |
| 24 switch (config) { | 25 switch (config) { |
| 25 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE: | 26 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE: |
| 26 g_horiz_threshold_complete = value; | 27 g_horiz_threshold_complete = value; |
| 27 break; | 28 break; |
| 28 | 29 |
| 29 case OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE: | 30 case OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE: |
| 30 g_vert_threshold_complete = value; | 31 g_vert_threshold_complete = value; |
| 31 break; | 32 break; |
| 32 | 33 |
| 33 case OVERSCROLL_CONFIG_MIN_THRESHOLD_START: | 34 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START: |
| 34 g_min_threshold_start = value; | 35 g_horiz_threshold_start = value; |
| 36 break; |
| 37 |
| 38 case OVERSCROLL_CONFIG_VERT_THRESHOLD_START: |
| 39 g_vert_threshold_start = value; |
| 35 break; | 40 break; |
| 36 | 41 |
| 37 case OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER: | 42 case OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER: |
| 38 g_horiz_resist_after = value; | 43 g_horiz_resist_after = value; |
| 39 break; | 44 break; |
| 40 | 45 |
| 41 case OVERSCROLL_CONFIG_VERT_RESIST_AFTER: | 46 case OVERSCROLL_CONFIG_VERT_RESIST_AFTER: |
| 42 g_vert_resist_after = value; | 47 g_vert_resist_after = value; |
| 43 break; | 48 break; |
| 44 | 49 |
| 45 case OVERSCROLL_CONFIG_NONE: | 50 case OVERSCROLL_CONFIG_NONE: |
| 46 case OVERSCROLL_CONFIG_COUNT: | 51 case OVERSCROLL_CONFIG_COUNT: |
| 47 NOTREACHED(); | 52 NOTREACHED(); |
| 48 } | 53 } |
| 49 } | 54 } |
| 50 | 55 |
| 51 float GetOverscrollConfig(OverscrollConfig config) { | 56 float GetOverscrollConfig(OverscrollConfig config) { |
| 52 switch (config) { | 57 switch (config) { |
| 53 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE: | 58 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE: |
| 54 return g_horiz_threshold_complete; | 59 return g_horiz_threshold_complete; |
| 55 | 60 |
| 56 case OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE: | 61 case OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE: |
| 57 return g_vert_threshold_complete; | 62 return g_vert_threshold_complete; |
| 58 | 63 |
| 59 case OVERSCROLL_CONFIG_MIN_THRESHOLD_START: | 64 case OVERSCROLL_CONFIG_HORIZ_THRESHOLD_START: |
| 60 return g_min_threshold_start; | 65 return g_horiz_threshold_start; |
| 66 |
| 67 case OVERSCROLL_CONFIG_VERT_THRESHOLD_START: |
| 68 return g_vert_threshold_start; |
| 61 | 69 |
| 62 case OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER: | 70 case OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER: |
| 63 return g_horiz_resist_after; | 71 return g_horiz_resist_after; |
| 64 | 72 |
| 65 case OVERSCROLL_CONFIG_VERT_RESIST_AFTER: | 73 case OVERSCROLL_CONFIG_VERT_RESIST_AFTER: |
| 66 return g_vert_resist_after; | 74 return g_vert_resist_after; |
| 67 | 75 |
| 68 case OVERSCROLL_CONFIG_NONE: | 76 case OVERSCROLL_CONFIG_NONE: |
| 69 case OVERSCROLL_CONFIG_COUNT: | 77 case OVERSCROLL_CONFIG_COUNT: |
| 70 NOTREACHED(); | 78 NOTREACHED(); |
| 71 } | 79 } |
| 72 | 80 |
| 73 return -1.f; | 81 return -1.f; |
| 74 } | 82 } |
| 75 | 83 |
| 76 } // namespace content | 84 } // namespace content |
| OLD | NEW |