| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/ui/webui/chromeos/salsa_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/salsa_ui.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 16 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
| 17 #include "content/public/browser/web_ui_data_source.h" | 17 #include "content/public/browser/web_ui_data_source.h" |
| 18 #include "grit/browser_resources.h" | 18 #include "grit/browser_resources.h" |
| 19 | 19 |
| 20 // Whitelist of which preferences are possible targets for Salsa treatments. | 20 // Whitelist of which preferences are possible targets for Salsa treatments. |
| 21 // If new preferences are added and they are to be used in an experiment, then | 21 // If new preferences are added and they are to be used in an experiment, then |
| 22 // they must be added to this list as well to keep chrome://salsa from | 22 // they must be added to this list as well to keep chrome://salsa from |
| 23 // changing arbitrary values. | 23 // changing arbitrary values. |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 const char* kWhitelist[] = { | 27 const char* kWhitelist[] = { |
| 28 prefs::kFlingMaxCancelToDownTimeInMs, | |
| 29 prefs::kFlingMaxTapGapTimeInMs, | |
| 30 prefs::kLongPressTimeInSeconds, | |
| 31 prefs::kLongPressTimeInSeconds, | |
| 32 prefs::kMaxSecondsBetweenDoubleClick, | |
| 33 prefs::kMaxSeparationForGestureTouchesInPixels, | 28 prefs::kMaxSeparationForGestureTouchesInPixels, |
| 34 prefs::kMaxSwipeDeviationRatio, | |
| 35 prefs::kMaxTouchDownDurationInSecondsForClick, | |
| 36 prefs::kMaxTouchMoveInPixelsForClick, | |
| 37 prefs::kMaxDistanceBetweenTapsForDoubleTap, | |
| 38 prefs::kMaxDistanceForTwoFingerTapInPixels, | |
| 39 prefs::kMinDistanceForPinchScrollInPixels, | |
| 40 prefs::kMinFlickSpeedSquared, | |
| 41 prefs::kMinPinchUpdateDistanceInPixels, | |
| 42 prefs::kMinRailBreakVelocity, | |
| 43 prefs::kMinScrollDeltaSquared, | |
| 44 prefs::kMinSwipeSpeed, | |
| 45 prefs::kMinTouchDownDurationInSecondsForClick, | |
| 46 prefs::kPointsBufferedForVelocity, | |
| 47 prefs::kRailBreakProportion, | |
| 48 prefs::kRailStartProportion, | |
| 49 prefs::kFlingAccelerationCurveCoefficient0, | 29 prefs::kFlingAccelerationCurveCoefficient0, |
| 50 prefs::kFlingAccelerationCurveCoefficient1, | 30 prefs::kFlingAccelerationCurveCoefficient1, |
| 51 prefs::kFlingAccelerationCurveCoefficient2, | 31 prefs::kFlingAccelerationCurveCoefficient2, |
| 52 prefs::kFlingAccelerationCurveCoefficient3, | 32 prefs::kFlingAccelerationCurveCoefficient3, |
| 53 prefs::kFlingVelocityCap, | |
| 54 prefs::kTabScrubActivationDelayInMS, | 33 prefs::kTabScrubActivationDelayInMS, |
| 55 prefs::kOverscrollHorizontalThresholdComplete, | 34 prefs::kOverscrollHorizontalThresholdComplete, |
| 56 prefs::kOverscrollVerticalThresholdComplete, | 35 prefs::kOverscrollVerticalThresholdComplete, |
| 57 prefs::kOverscrollMinimumThresholdStart, | 36 prefs::kOverscrollMinimumThresholdStart, |
| 58 prefs::kOverscrollVerticalThresholdStart, | 37 prefs::kOverscrollVerticalThresholdStart, |
| 59 prefs::kOverscrollHorizontalResistThreshold, | 38 prefs::kOverscrollHorizontalResistThreshold, |
| 60 prefs::kOverscrollVerticalResistThreshold, | 39 prefs::kOverscrollVerticalResistThreshold, |
| 61 prefs::kFlingCurveTouchscreenAlpha, | 40 prefs::kFlingCurveTouchscreenAlpha, |
| 62 prefs::kFlingCurveTouchscreenBeta, | 41 prefs::kFlingCurveTouchscreenBeta, |
| 63 prefs::kFlingCurveTouchscreenGamma, | 42 prefs::kFlingCurveTouchscreenGamma, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 158 |
| 180 if (!pref) | 159 if (!pref) |
| 181 return; | 160 return; |
| 182 | 161 |
| 183 // Get our own copy of the user defined value or NULL if they are using the | 162 // Get our own copy of the user defined value or NULL if they are using the |
| 184 // default. You have to make a copy since they'll be used in the destructor | 163 // default. You have to make a copy since they'll be used in the destructor |
| 185 // to restore the values and we need to make sure they're still around. | 164 // to restore the values and we need to make sure they're still around. |
| 186 orig_values_[index] = | 165 orig_values_[index] = |
| 187 pref->IsDefaultValue() ? NULL : pref->GetValue()->DeepCopy(); | 166 pref->IsDefaultValue() ? NULL : pref->GetValue()->DeepCopy(); |
| 188 } | 167 } |
| OLD | NEW |