Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: chrome/browser/ui/gesture_prefs_observer_factory_aura.cc

Issue 422493003: Remove deprecated gesture configuration parameters. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/gesture_prefs_observer_factory_aura.h" 5 #include "chrome/browser/ui/gesture_prefs_observer_factory_aura.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/prefs/pref_change_registrar.h" 12 #include "base/prefs/pref_change_registrar.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/profiles/incognito_helpers.h" 15 #include "chrome/browser/profiles/incognito_helpers.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/common/pref_names.h" 17 #include "chrome/common/pref_names.h"
18 #include "components/keyed_service/content/browser_context_dependency_manager.h" 18 #include "components/keyed_service/content/browser_context_dependency_manager.h"
19 #include "components/pref_registry/pref_registry_syncable.h" 19 #include "components/pref_registry/pref_registry_syncable.h"
20 #include "content/public/browser/notification_observer.h" 20 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_service.h" 21 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/overscroll_configuration.h" 22 #include "content/public/browser/overscroll_configuration.h"
23 #include "content/public/common/renderer_preferences.h" 23 #include "content/public/common/renderer_preferences.h"
24 #include "ui/events/gestures/gesture_configuration.h" 24 #include "ui/events/gestures/gesture_configuration.h"
25 25
26 using ui::GestureConfiguration; 26 using ui::GestureConfiguration;
27 27
28 namespace { 28 namespace {
29 29
30 // TODO(tdresser): Remove these deprecated prefs in M38. See crbug.com/379912.
31
32 const char kFlingVelocityCap[] = "gesture.fling_velocity_cap";
33 const char kLongPressTimeInSeconds[] =
34 "gesture.long_press_time_in_seconds";
35 const char kMaxDistanceBetweenTapsForDoubleTap[] =
36 "gesture.max_distance_between_taps_for_double_tap";
37 const char kMaxDistanceForTwoFingerTapInPixels[] =
38 "gesture.max_distance_for_two_finger_tap_in_pixels";
39 const char kMaxSecondsBetweenDoubleClick[] =
40 "gesture.max_seconds_between_double_click";
41 const char kMaxSwipeDeviationRatio[] =
42 "gesture.max_swipe_deviation_ratio";
43 const char kMaxTouchDownDurationInSecondsForClick[] =
44 "gesture.max_touch_down_duration_in_seconds_for_click";
45 const char kMaxTouchMoveInPixelsForClick[] =
46 "gesture.max_touch_move_in_pixels_for_click";
47 const char kMinDistanceForPinchScrollInPixels[] =
48 "gesture.min_distance_for_pinch_scroll_in_pixels";
49 const char kMinFlickSpeedSquared[] =
50 "gesture.min_flick_speed_squared";
51 const char kMinPinchUpdateDistanceInPixels[] =
52 "gesture.min_pinch_update_distance_in_pixels";
53 const char kMinRailBreakVelocity[] =
54 "gesture.min_rail_break_velocity";
55 const char kMinScrollDeltaSquared[] =
56 "gesture.min_scroll_delta_squared";
57 const char kMinSwipeSpeed[] =
58 "gesture.min_swipe_speed";
59 const char kMinTouchDownDurationInSecondsForClick[] =
60 "gesture.min_touch_down_duration_in_seconds_for_click";
61 const char kPointsBufferedForVelocity[] =
62 "gesture.points_buffered_for_velocity";
63 const char kRailBreakProportion[] =
64 "gesture.rail_break_proportion";
65 const char kRailStartProportion[] =
66 "gesture.rail_start_proportion";
67 const char kScrollPredictionSeconds[] =
68 "gesture.scroll_prediction_seconds";
69 const char kShowPressDelayInMS[] =
70 "gesture.show_press_delay_in_ms";
71
72 struct OverscrollPref { 30 struct OverscrollPref {
73 const char* pref_name; 31 const char* pref_name;
74 content::OverscrollConfig config; 32 content::OverscrollConfig config;
75 }; 33 };
76 34
77 const std::vector<OverscrollPref>& GetOverscrollPrefs() { 35 const std::vector<OverscrollPref>& GetOverscrollPrefs() {
78 CR_DEFINE_STATIC_LOCAL(std::vector<OverscrollPref>, overscroll_prefs, ()); 36 CR_DEFINE_STATIC_LOCAL(std::vector<OverscrollPref>, overscroll_prefs, ());
79 if (overscroll_prefs.empty()) { 37 if (overscroll_prefs.empty()) {
80 using namespace content; 38 using namespace content;
81 const OverscrollPref kOverscrollPrefs[] = { 39 const OverscrollPref kOverscrollPrefs[] = {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 prefs::kFlingCurveTouchpadBeta, 107 prefs::kFlingCurveTouchpadBeta,
150 prefs::kFlingCurveTouchpadGamma 108 prefs::kFlingCurveTouchpadGamma
151 }; 109 };
152 110
153 const char* kFlingTouchscreenPrefs[] = { 111 const char* kFlingTouchscreenPrefs[] = {
154 prefs::kFlingCurveTouchscreenAlpha, 112 prefs::kFlingCurveTouchscreenAlpha,
155 prefs::kFlingCurveTouchscreenBeta, 113 prefs::kFlingCurveTouchscreenBeta,
156 prefs::kFlingCurveTouchscreenGamma, 114 prefs::kFlingCurveTouchscreenGamma,
157 }; 115 };
158 116
159 const char* kPrefsToRemove[] = {
160 kFlingVelocityCap,
161 kLongPressTimeInSeconds,
162 kMaxDistanceBetweenTapsForDoubleTap,
163 kMaxDistanceForTwoFingerTapInPixels,
164 kMaxSecondsBetweenDoubleClick,
165 kMaxSwipeDeviationRatio,
166 kMaxTouchDownDurationInSecondsForClick,
167 kMaxTouchMoveInPixelsForClick,
168 kMinDistanceForPinchScrollInPixels,
169 kMinFlickSpeedSquared,
170 kMinPinchUpdateDistanceInPixels,
171 kMinRailBreakVelocity,
172 kMinScrollDeltaSquared,
173 kMinSwipeSpeed,
174 kMinTouchDownDurationInSecondsForClick,
175 kPointsBufferedForVelocity,
176 kRailBreakProportion,
177 kRailStartProportion,
178 kScrollPredictionSeconds,
179 kShowPressDelayInMS,
180 };
181
182 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs) 117 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs)
183 : prefs_(prefs) { 118 : prefs_(prefs) {
184 // Clear for migration.
185 for (size_t i = 0; i < arraysize(kPrefsToRemove); ++i) {
186 if (prefs->FindPreference(kPrefsToRemove[i]))
187 prefs->ClearPref(kPrefsToRemove[i]);
188 }
189
190 registrar_.Init(prefs); 119 registrar_.Init(prefs);
191 registrar_.RemoveAll(); 120 registrar_.RemoveAll();
192 base::Closure callback = base::Bind(&GesturePrefsObserver::Update, 121 base::Closure callback = base::Bind(&GesturePrefsObserver::Update,
193 base::Unretained(this)); 122 base::Unretained(this));
194 123
195 base::Closure notify_callback = base::Bind(&GesturePrefsObserver::Notify, 124 base::Closure notify_callback = base::Bind(&GesturePrefsObserver::Notify,
196 base::Unretained(this)); 125 base::Unretained(this));
197 126
198 for (size_t i = 0; i < arraysize(kPrefsToObserve); ++i) 127 for (size_t i = 0; i < arraysize(kPrefsToObserve); ++i)
199 registrar_.Add(kPrefsToObserve[i], callback); 128 registrar_.Add(kPrefsToObserve[i], callback);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Use same gesture preferences on incognito windows. 290 // Use same gesture preferences on incognito windows.
362 return chrome::GetBrowserContextRedirectedInIncognito(context); 291 return chrome::GetBrowserContextRedirectedInIncognito(context);
363 } 292 }
364 293
365 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { 294 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const {
366 // Some tests replace the PrefService of the TestingProfile after the 295 // Some tests replace the PrefService of the TestingProfile after the
367 // GesturePrefsObserver has been created, which makes Shutdown() 296 // GesturePrefsObserver has been created, which makes Shutdown()
368 // remove the registrar from a non-existent PrefService. 297 // remove the registrar from a non-existent PrefService.
369 return true; 298 return true;
370 } 299 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698