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

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

Issue 12212040: Make the workspace cycler animation parameters editable via chrome://gesture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | « chrome/browser/ui/gesture_prefs_observer_factory_aura.h ('k') | chrome/common/pref_names.h » ('j') | 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) 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 "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>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
10 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
11 #include "base/prefs/public/pref_change_registrar.h" 13 #include "base/prefs/public/pref_change_registrar.h"
12 #include "chrome/browser/prefs/pref_registry_syncable.h" 14 #include "chrome/browser/prefs/pref_registry_syncable.h"
13 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/profiles/profile_dependency_manager.h" 16 #include "chrome/browser/profiles/profile_dependency_manager.h"
15 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
17 #include "content/public/browser/notification_observer.h" 19 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
19 #include "content/public/browser/overscroll_configuration.h" 21 #include "content/public/browser/overscroll_configuration.h"
20 #include "content/public/common/renderer_preferences.h" 22 #include "content/public/common/renderer_preferences.h"
21 #include "ui/base/gestures/gesture_configuration.h" 23 #include "ui/base/gestures/gesture_configuration.h"
22 24
25 #if defined(USE_ASH)
26 #include "ash/wm/workspace/workspace_cycler_configuration.h"
27 #endif // USE_ASH
28
29 #if defined(USE_ASH)
30 using ash::WorkspaceCyclerConfiguration;
31 #endif // USE_ASH
32
23 using ui::GestureConfiguration; 33 using ui::GestureConfiguration;
24 34
25 namespace { 35 namespace {
26 36
27 struct OverscrollPref { 37 struct OverscrollPref {
28 const char* pref_name; 38 const char* pref_name;
29 content::OverscrollConfig config; 39 content::OverscrollConfig config;
30 }; 40 };
31 41
32 // This class manages gesture configuration preferences. 42 const std::vector<OverscrollPref>& GetOverscrollPrefs() {
33 class GesturePrefsObserver : public ProfileKeyedService { 43 CR_DEFINE_STATIC_LOCAL(std::vector<OverscrollPref>, overscroll_prefs, ());
34 public: 44 if (overscroll_prefs.empty()) {
35 explicit GesturePrefsObserver(PrefService* prefs);
36 virtual ~GesturePrefsObserver();
37
38 static const OverscrollPref* GetOverscrollPrefs() {
39 using namespace content; 45 using namespace content;
40 static OverscrollPref overscroll_prefs[] = { 46 const OverscrollPref kOverscrollPrefs[] = {
41 { prefs::kOverscrollHorizontalThresholdComplete, 47 { prefs::kOverscrollHorizontalThresholdComplete,
42 OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE }, 48 OVERSCROLL_CONFIG_HORIZ_THRESHOLD_COMPLETE },
43 { prefs::kOverscrollVerticalThresholdComplete, 49 { prefs::kOverscrollVerticalThresholdComplete,
44 OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE }, 50 OVERSCROLL_CONFIG_VERT_THRESHOLD_COMPLETE },
45 { prefs::kOverscrollMinimumThresholdStart, 51 { prefs::kOverscrollMinimumThresholdStart,
46 OVERSCROLL_CONFIG_MIN_THRESHOLD_START }, 52 OVERSCROLL_CONFIG_MIN_THRESHOLD_START },
47 { prefs::kOverscrollHorizontalResistThreshold, 53 { prefs::kOverscrollHorizontalResistThreshold,
48 OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER }, 54 OVERSCROLL_CONFIG_HORIZ_RESIST_AFTER },
49 { prefs::kOverscrollVerticalResistThreshold, 55 { prefs::kOverscrollVerticalResistThreshold,
50 OVERSCROLL_CONFIG_VERT_RESIST_AFTER }, 56 OVERSCROLL_CONFIG_VERT_RESIST_AFTER },
51 { NULL,
52 OVERSCROLL_CONFIG_NONE },
53 }; 57 };
58 overscroll_prefs.assign(kOverscrollPrefs,
59 kOverscrollPrefs + arraysize(kOverscrollPrefs));
60 }
61 return overscroll_prefs;
62 }
54 63
55 return overscroll_prefs; 64 #if defined(USE_ASH)
65 struct WorkspaceCyclerPref {
66 const char* pref_name;
67 WorkspaceCyclerConfiguration::Property property;
68 };
69
70 const std::vector<WorkspaceCyclerPref>& GetWorkspaceCyclerPrefs() {
71 CR_DEFINE_STATIC_LOCAL(std::vector<WorkspaceCyclerPref>, cycler_prefs, ());
72 if (cycler_prefs.empty() && WorkspaceCyclerConfiguration::IsCyclerEnabled()) {
73 const WorkspaceCyclerPref kCyclerPrefs[] = {
74 { prefs::kWorkspaceCyclerShallowerThanSelectedYOffsets,
75 WorkspaceCyclerConfiguration::SHALLOWER_THAN_SELECTED_Y_OFFSETS },
76 { prefs::kWorkspaceCyclerDeeperThanSelectedYOffsets,
77 WorkspaceCyclerConfiguration::DEEPER_THAN_SELECTED_Y_OFFSETS },
78 { prefs::kWorkspaceCyclerSelectedYOffset,
79 WorkspaceCyclerConfiguration::SELECTED_Y_OFFSET },
80 { prefs::kWorkspaceCyclerSelectedScale,
81 WorkspaceCyclerConfiguration::SELECTED_SCALE },
82 { prefs::kWorkspaceCyclerMinScale,
83 WorkspaceCyclerConfiguration::MIN_SCALE },
84 { prefs::kWorkspaceCyclerMaxScale,
85 WorkspaceCyclerConfiguration::MAX_SCALE },
86 { prefs::kWorkspaceCyclerMinBrightness,
87 WorkspaceCyclerConfiguration::MIN_BRIGHTNESS },
88 { prefs::kWorkspaceCyclerBackgroundOpacity,
89 WorkspaceCyclerConfiguration::BACKGROUND_OPACITY },
90 { prefs::kWorkspaceCyclerDistanceToInitiateCycling,
91 WorkspaceCyclerConfiguration::DISTANCE_TO_INITIATE_CYCLING },
92 { prefs::kWorkspaceCyclerScrollDistanceToCycleToNextWorkspace,
93 WorkspaceCyclerConfiguration::
94 SCROLL_DISTANCE_TO_CYCLE_TO_NEXT_WORKSPACE },
95 { prefs::kWorkspaceCyclerCyclerStepAnimationDurationRatio,
96 WorkspaceCyclerConfiguration::CYCLER_STEP_ANIMATION_DURATION_RATIO },
97 { prefs::kWorkspaceCyclerStartCyclerAnimationDuration,
98 WorkspaceCyclerConfiguration::START_CYCLER_ANIMATION_DURATION },
99 { prefs::kWorkspaceCyclerStopCyclerAnimationDuration,
100 WorkspaceCyclerConfiguration::STOP_CYCLER_ANIMATION_DURATION },
101 };
102 cycler_prefs.assign(kCyclerPrefs, kCyclerPrefs + arraysize(kCyclerPrefs));
56 } 103 }
104 return cycler_prefs;
105 }
106 #endif // USE_ASH
107
108 // This class manages gesture configuration preferences.
109 class GesturePrefsObserver : public ProfileKeyedService {
110 public:
111 explicit GesturePrefsObserver(PrefService* prefs);
112 virtual ~GesturePrefsObserver();
57 113
58 // ProfileKeyedService implementation. 114 // ProfileKeyedService implementation.
59 virtual void Shutdown() OVERRIDE; 115 virtual void Shutdown() OVERRIDE;
60 116
61 private: 117 private:
62 // Notification callback invoked when browser-side preferences 118 // Notification callback invoked when browser-side preferences
63 // are updated and need to be pushed into ui::GesturePreferences. 119 // are updated and need to be pushed into ui::GesturePreferences.
64 void Update(); 120 void Update();
65 121
66 // Notification callback invoked when the fling deacceleration 122 // Notification callback invoked when the fling deacceleration
67 // gesture preferences are changed from chrome://gesture. 123 // gesture preferences are changed from chrome://gesture.
68 // Broadcasts the changes all renderers where they are used. 124 // Broadcasts the changes all renderers where they are used.
69 void Notify(); 125 void Notify();
70 126
71 // Notification helper to push overscroll preferences into 127 // Notification helper to push overscroll preferences into
72 // content. 128 // content.
73 void UpdateOverscrollPrefs(); 129 void UpdateOverscrollPrefs();
130 void UpdateWorkspaceCyclerPrefs();
74 131
75 PrefChangeRegistrar registrar_; 132 PrefChangeRegistrar registrar_;
76 PrefService* prefs_; 133 PrefService* prefs_;
77 134
78 DISALLOW_COPY_AND_ASSIGN(GesturePrefsObserver); 135 DISALLOW_COPY_AND_ASSIGN(GesturePrefsObserver);
79 }; 136 };
80 137
81 // The list of prefs we want to observe. 138 // The list of prefs we want to observe.
82 // Note that this collection of settings should correspond to the settings used 139 // Note that this collection of settings should correspond to the settings used
83 // in ui/base/gestures/gesture_configuration.h 140 // in ui/base/gestures/gesture_configuration.h
(...skipping 18 matching lines...) Expand all
102 prefs::kMinRailBreakVelocity, 159 prefs::kMinRailBreakVelocity,
103 prefs::kMinScrollDeltaSquared, 160 prefs::kMinScrollDeltaSquared,
104 prefs::kMinSwipeSpeed, 161 prefs::kMinSwipeSpeed,
105 prefs::kMinTouchDownDurationInSecondsForClick, 162 prefs::kMinTouchDownDurationInSecondsForClick,
106 prefs::kPointsBufferedForVelocity, 163 prefs::kPointsBufferedForVelocity,
107 prefs::kRailBreakProportion, 164 prefs::kRailBreakProportion,
108 prefs::kRailStartProportion, 165 prefs::kRailStartProportion,
109 prefs::kSemiLongPressTimeInSeconds, 166 prefs::kSemiLongPressTimeInSeconds,
110 }; 167 };
111 168
112 const char* kOverscrollPrefs[] = {
113 prefs::kOverscrollHorizontalThresholdComplete,
114 prefs::kOverscrollVerticalThresholdComplete,
115 prefs::kOverscrollMinimumThresholdStart,
116 prefs::kOverscrollHorizontalResistThreshold,
117 prefs::kOverscrollVerticalResistThreshold,
118 };
119
120 const char* kFlingTouchpadPrefs[] = { 169 const char* kFlingTouchpadPrefs[] = {
121 prefs::kFlingCurveTouchpadAlpha, 170 prefs::kFlingCurveTouchpadAlpha,
122 prefs::kFlingCurveTouchpadBeta, 171 prefs::kFlingCurveTouchpadBeta,
123 prefs::kFlingCurveTouchpadGamma 172 prefs::kFlingCurveTouchpadGamma
124 }; 173 };
125 174
126 const char* kFlingTouchscreenPrefs[] = { 175 const char* kFlingTouchscreenPrefs[] = {
127 prefs::kFlingCurveTouchscreenAlpha, 176 prefs::kFlingCurveTouchscreenAlpha,
128 prefs::kFlingCurveTouchscreenBeta, 177 prefs::kFlingCurveTouchscreenBeta,
129 prefs::kFlingCurveTouchscreenGamma, 178 prefs::kFlingCurveTouchscreenGamma,
130 }; 179 };
131 180
132 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs) 181 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs)
133 : prefs_(prefs) { 182 : prefs_(prefs) {
134 registrar_.Init(prefs); 183 registrar_.Init(prefs);
135 registrar_.RemoveAll(); 184 registrar_.RemoveAll();
136 base::Closure callback = base::Bind(&GesturePrefsObserver::Update, 185 base::Closure callback = base::Bind(&GesturePrefsObserver::Update,
137 base::Unretained(this)); 186 base::Unretained(this));
138 187
139 base::Closure notify_callback = base::Bind(&GesturePrefsObserver::Notify, 188 base::Closure notify_callback = base::Bind(&GesturePrefsObserver::Notify,
140 base::Unretained(this)); 189 base::Unretained(this));
141 190
142 for (size_t i = 0; i < arraysize(kPrefsToObserve); ++i) 191 for (size_t i = 0; i < arraysize(kPrefsToObserve); ++i)
143 registrar_.Add(kPrefsToObserve[i], callback); 192 registrar_.Add(kPrefsToObserve[i], callback);
144 for (size_t i = 0; i < arraysize(kOverscrollPrefs); ++i) 193
145 registrar_.Add(kOverscrollPrefs[i], callback); 194 const std::vector<OverscrollPref>& overscroll_prefs = GetOverscrollPrefs();
195 for (size_t i = 0; i < overscroll_prefs.size(); ++i)
196 registrar_.Add(overscroll_prefs[i].pref_name, callback);
146 197
147 for (size_t i = 0; i < arraysize(kFlingTouchpadPrefs); ++i) 198 for (size_t i = 0; i < arraysize(kFlingTouchpadPrefs); ++i)
148 registrar_.Add(kFlingTouchpadPrefs[i], notify_callback); 199 registrar_.Add(kFlingTouchpadPrefs[i], notify_callback);
149 for (size_t i = 0; i < arraysize(kFlingTouchscreenPrefs); ++i) 200 for (size_t i = 0; i < arraysize(kFlingTouchscreenPrefs); ++i)
150 registrar_.Add(kFlingTouchscreenPrefs[i], notify_callback); 201 registrar_.Add(kFlingTouchscreenPrefs[i], notify_callback);
202
203 #if defined(USE_ASH)
204 const std::vector<WorkspaceCyclerPref>& cycler_prefs =
205 GetWorkspaceCyclerPrefs();
206 for (size_t i = 0; i < cycler_prefs.size(); ++i)
207 registrar_.Add(cycler_prefs[i].pref_name, callback);
208 #endif // USE_ASH
151 } 209 }
152 210
153 GesturePrefsObserver::~GesturePrefsObserver() {} 211 GesturePrefsObserver::~GesturePrefsObserver() {}
154 212
155 void GesturePrefsObserver::Shutdown() { 213 void GesturePrefsObserver::Shutdown() {
156 registrar_.RemoveAll(); 214 registrar_.RemoveAll();
157 } 215 }
158 216
159 void GesturePrefsObserver::Update() { 217 void GesturePrefsObserver::Update() {
160 GestureConfiguration::set_fling_acceleration_curve_coefficients(0, 218 GestureConfiguration::set_fling_acceleration_curve_coefficients(0,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 prefs_->GetInteger( 281 prefs_->GetInteger(
224 prefs::kPointsBufferedForVelocity)); 282 prefs::kPointsBufferedForVelocity));
225 GestureConfiguration::set_rail_break_proportion( 283 GestureConfiguration::set_rail_break_proportion(
226 prefs_->GetDouble( 284 prefs_->GetDouble(
227 prefs::kRailBreakProportion)); 285 prefs::kRailBreakProportion));
228 GestureConfiguration::set_rail_start_proportion( 286 GestureConfiguration::set_rail_start_proportion(
229 prefs_->GetDouble( 287 prefs_->GetDouble(
230 prefs::kRailStartProportion)); 288 prefs::kRailStartProportion));
231 289
232 UpdateOverscrollPrefs(); 290 UpdateOverscrollPrefs();
291 UpdateWorkspaceCyclerPrefs();
233 } 292 }
234 293
235 void GesturePrefsObserver::UpdateOverscrollPrefs() { 294 void GesturePrefsObserver::UpdateOverscrollPrefs() {
236 const OverscrollPref* overscroll_prefs = 295 const std::vector<OverscrollPref>& overscroll_prefs = GetOverscrollPrefs();
237 GesturePrefsObserver::GetOverscrollPrefs(); 296 for (size_t i = 0; i < overscroll_prefs.size(); ++i) {
238 for (int i = 0; overscroll_prefs[i].pref_name; ++i) {
239 content::SetOverscrollConfig(overscroll_prefs[i].config, 297 content::SetOverscrollConfig(overscroll_prefs[i].config,
240 static_cast<float>(prefs_->GetDouble(overscroll_prefs[i].pref_name))); 298 static_cast<float>(prefs_->GetDouble(overscroll_prefs[i].pref_name)));
241 } 299 }
242 } 300 }
243 301
302 void GesturePrefsObserver::UpdateWorkspaceCyclerPrefs() {
303 #if defined(USE_ASH)
304 const std::vector<WorkspaceCyclerPref>& cycler_prefs =
305 GetWorkspaceCyclerPrefs();
306 for (size_t i = 0; i < cycler_prefs.size(); ++i) {
307 WorkspaceCyclerConfiguration::Property property =
308 cycler_prefs[i].property;
309 if (WorkspaceCyclerConfiguration::IsListProperty(property)) {
310 WorkspaceCyclerConfiguration::SetListValue(property,
311 *prefs_->GetList(cycler_prefs[i].pref_name));
312 } else {
313 WorkspaceCyclerConfiguration::SetDouble(property,
314 prefs_->GetDouble(cycler_prefs[i].pref_name));
315 }
316 }
317 #endif // USE_ASH
318 }
319
244 void GesturePrefsObserver::Notify() { 320 void GesturePrefsObserver::Notify() {
245 // Must do a notify to distribute the changes to all renderers. 321 // Must do a notify to distribute the changes to all renderers.
246 content::NotificationService* service = 322 content::NotificationService* service =
247 content::NotificationService::current(); 323 content::NotificationService::current();
248 service->Notify(chrome::NOTIFICATION_BROWSER_FLING_CURVE_PARAMETERS_CHANGED, 324 service->Notify(chrome::NOTIFICATION_BROWSER_FLING_CURVE_PARAMETERS_CHANGED,
249 content::Source<GesturePrefsObserver>(this), 325 content::Source<GesturePrefsObserver>(this),
250 content::NotificationService::NoDetails()); 326 content::NotificationService::NoDetails());
251 } 327 }
252 328
253 } // namespace 329 } // namespace
(...skipping 10 matching lines...) Expand all
264 340
265 GesturePrefsObserverFactoryAura::~GesturePrefsObserverFactoryAura() {} 341 GesturePrefsObserverFactoryAura::~GesturePrefsObserverFactoryAura() {}
266 342
267 ProfileKeyedService* GesturePrefsObserverFactoryAura::BuildServiceInstanceFor( 343 ProfileKeyedService* GesturePrefsObserverFactoryAura::BuildServiceInstanceFor(
268 Profile* profile) const { 344 Profile* profile) const {
269 return new GesturePrefsObserver(profile->GetPrefs()); 345 return new GesturePrefsObserver(profile->GetPrefs());
270 } 346 }
271 347
272 void GesturePrefsObserverFactoryAura::RegisterOverscrollPrefs( 348 void GesturePrefsObserverFactoryAura::RegisterOverscrollPrefs(
273 PrefRegistrySyncable* registry) { 349 PrefRegistrySyncable* registry) {
274 const OverscrollPref* overscroll_prefs = 350 const std::vector<OverscrollPref>& overscroll_prefs = GetOverscrollPrefs();
275 GesturePrefsObserver::GetOverscrollPrefs();
276 351
277 for (int i = 0; overscroll_prefs[i].pref_name; ++i) { 352 for (size_t i = 0; i < overscroll_prefs.size(); ++i) {
278 registry->RegisterDoublePref( 353 registry->RegisterDoublePref(
279 overscroll_prefs[i].pref_name, 354 overscroll_prefs[i].pref_name,
280 content::GetOverscrollConfig(overscroll_prefs[i].config), 355 content::GetOverscrollConfig(overscroll_prefs[i].config),
281 PrefRegistrySyncable::UNSYNCABLE_PREF); 356 PrefRegistrySyncable::UNSYNCABLE_PREF);
282 } 357 }
283 } 358 }
284 359
285 void GesturePrefsObserverFactoryAura::RegisterFlingCurveParameters( 360 void GesturePrefsObserverFactoryAura::RegisterFlingCurveParameters(
286 PrefRegistrySyncable* registry) { 361 PrefRegistrySyncable* registry) {
287 content::RendererPreferences def_prefs; 362 content::RendererPreferences def_prefs;
288 363
289 for (size_t i = 0; i < arraysize(kFlingTouchpadPrefs); i++) 364 for (size_t i = 0; i < arraysize(kFlingTouchpadPrefs); i++)
290 registry->RegisterDoublePref(kFlingTouchpadPrefs[i], 365 registry->RegisterDoublePref(kFlingTouchpadPrefs[i],
291 def_prefs.touchpad_fling_profile[i], 366 def_prefs.touchpad_fling_profile[i],
292 PrefRegistrySyncable::UNSYNCABLE_PREF); 367 PrefRegistrySyncable::UNSYNCABLE_PREF);
293 368
294 for (size_t i = 0; i < arraysize(kFlingTouchscreenPrefs); i++) 369 for (size_t i = 0; i < arraysize(kFlingTouchscreenPrefs); i++)
295 registry->RegisterDoublePref(kFlingTouchscreenPrefs[i], 370 registry->RegisterDoublePref(kFlingTouchscreenPrefs[i],
296 def_prefs.touchscreen_fling_profile[i], 371 def_prefs.touchscreen_fling_profile[i],
297 PrefRegistrySyncable::UNSYNCABLE_PREF); 372 PrefRegistrySyncable::UNSYNCABLE_PREF);
298 } 373 }
299 374
375 void GesturePrefsObserverFactoryAura::RegisterWorkspaceCyclerPrefs(
376 PrefRegistrySyncable* registry) {
377 #if defined(USE_ASH)
378 const std::vector<WorkspaceCyclerPref>& cycler_prefs =
379 GetWorkspaceCyclerPrefs();
380 for (size_t i = 0; i < cycler_prefs.size(); ++i) {
381 WorkspaceCyclerConfiguration::Property property =
382 cycler_prefs[i].property;
383 if (WorkspaceCyclerConfiguration::IsListProperty(property)) {
384 registry->RegisterListPref(
385 cycler_prefs[i].pref_name,
386 WorkspaceCyclerConfiguration::GetListValue(property).DeepCopy(),
387 PrefRegistrySyncable::UNSYNCABLE_PREF);
388 } else {
389 registry->RegisterDoublePref(
390 cycler_prefs[i].pref_name,
391 WorkspaceCyclerConfiguration::GetDouble(property),
392 PrefRegistrySyncable::UNSYNCABLE_PREF);
393 }
394 }
395 #endif // USE_ASH
396 }
397
300 void GesturePrefsObserverFactoryAura::DeprecatedRegisterUserPrefs( 398 void GesturePrefsObserverFactoryAura::DeprecatedRegisterUserPrefs(
301 PrefService* prefs, 399 PrefService* prefs,
302 PrefRegistrySyncable* registry) { 400 PrefRegistrySyncable* registry) {
303 registry->RegisterDoublePref( 401 registry->RegisterDoublePref(
304 prefs::kFlingAccelerationCurveCoefficient0, 402 prefs::kFlingAccelerationCurveCoefficient0,
305 GestureConfiguration::fling_acceleration_curve_coefficients(0), 403 GestureConfiguration::fling_acceleration_curve_coefficients(0),
306 PrefRegistrySyncable::UNSYNCABLE_PREF); 404 PrefRegistrySyncable::UNSYNCABLE_PREF);
307 registry->RegisterDoublePref( 405 registry->RegisterDoublePref(
308 prefs::kFlingAccelerationCurveCoefficient1, 406 prefs::kFlingAccelerationCurveCoefficient1,
309 GestureConfiguration::fling_acceleration_curve_coefficients(1), 407 GestureConfiguration::fling_acceleration_curve_coefficients(1),
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // TODO(rjkroege): Remove this in M29. http://crbug.com/160243. 506 // TODO(rjkroege): Remove this in M29. http://crbug.com/160243.
409 const char kTouchScreenFlingAccelerationAdjustment[] = 507 const char kTouchScreenFlingAccelerationAdjustment[] =
410 "gesture.touchscreen_fling_acceleration_adjustment"; 508 "gesture.touchscreen_fling_acceleration_adjustment";
411 registry->RegisterDoublePref(kTouchScreenFlingAccelerationAdjustment, 509 registry->RegisterDoublePref(kTouchScreenFlingAccelerationAdjustment,
412 0.0, 510 0.0,
413 PrefRegistrySyncable::UNSYNCABLE_PREF); 511 PrefRegistrySyncable::UNSYNCABLE_PREF);
414 prefs->ClearPref(kTouchScreenFlingAccelerationAdjustment); 512 prefs->ClearPref(kTouchScreenFlingAccelerationAdjustment);
415 513
416 RegisterOverscrollPrefs(registry); 514 RegisterOverscrollPrefs(registry);
417 RegisterFlingCurveParameters(registry); 515 RegisterFlingCurveParameters(registry);
516 RegisterWorkspaceCyclerPrefs(registry);
418 } 517 }
419 518
420 bool GesturePrefsObserverFactoryAura::ServiceIsCreatedWithProfile() const { 519 bool GesturePrefsObserverFactoryAura::ServiceIsCreatedWithProfile() const {
421 // Create the observer as soon as the profile is created. 520 // Create the observer as soon as the profile is created.
422 return true; 521 return true;
423 } 522 }
424 523
425 bool GesturePrefsObserverFactoryAura::ServiceRedirectedInIncognito() const { 524 bool GesturePrefsObserverFactoryAura::ServiceRedirectedInIncognito() const {
426 // Use same gesture preferences on incognito windows. 525 // Use same gesture preferences on incognito windows.
427 return true; 526 return true;
428 } 527 }
429 528
430 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { 529 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const {
431 // Some tests replace the PrefService of the TestingProfile after the 530 // Some tests replace the PrefService of the TestingProfile after the
432 // GesturePrefsObserver has been created, which makes Shutdown() 531 // GesturePrefsObserver has been created, which makes Shutdown()
433 // remove the registrar from a non-existent PrefService. 532 // remove the registrar from a non-existent PrefService.
434 return true; 533 return true;
435 } 534 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gesture_prefs_observer_factory_aura.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698