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

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

Issue 222783003: Remove kMinScrollSuccessiveVelocityEvents (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/user_prefs/pref_registry_syncable.h" 19 #include "components/user_prefs/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 this deprecated pref. See crbug.com/339486.
31 const char kMinScrollSuccessiveVelocityEvents[] =
32 "gesture.min_scroll_successive_velocity_events";
33
34 struct OverscrollPref { 30 struct OverscrollPref {
35 const char* pref_name; 31 const char* pref_name;
36 content::OverscrollConfig config; 32 content::OverscrollConfig config;
37 }; 33 };
38 34
39 const std::vector<OverscrollPref>& GetOverscrollPrefs() { 35 const std::vector<OverscrollPref>& GetOverscrollPrefs() {
40 CR_DEFINE_STATIC_LOCAL(std::vector<OverscrollPref>, overscroll_prefs, ()); 36 CR_DEFINE_STATIC_LOCAL(std::vector<OverscrollPref>, overscroll_prefs, ());
41 if (overscroll_prefs.empty()) { 37 if (overscroll_prefs.empty()) {
42 using namespace content; 38 using namespace content;
43 const OverscrollPref kOverscrollPrefs[] = { 39 const OverscrollPref kOverscrollPrefs[] = {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 }; 126 };
131 127
132 const char* kFlingTouchscreenPrefs[] = { 128 const char* kFlingTouchscreenPrefs[] = {
133 prefs::kFlingCurveTouchscreenAlpha, 129 prefs::kFlingCurveTouchscreenAlpha,
134 prefs::kFlingCurveTouchscreenBeta, 130 prefs::kFlingCurveTouchscreenBeta,
135 prefs::kFlingCurveTouchscreenGamma, 131 prefs::kFlingCurveTouchscreenGamma,
136 }; 132 };
137 133
138 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs) 134 GesturePrefsObserver::GesturePrefsObserver(PrefService* prefs)
139 : prefs_(prefs) { 135 : prefs_(prefs) {
140 // Clear for migration.
141 prefs->ClearPref(kMinScrollSuccessiveVelocityEvents);
142
143 registrar_.Init(prefs); 136 registrar_.Init(prefs);
144 registrar_.RemoveAll(); 137 registrar_.RemoveAll();
145 base::Closure callback = base::Bind(&GesturePrefsObserver::Update, 138 base::Closure callback = base::Bind(&GesturePrefsObserver::Update,
146 base::Unretained(this)); 139 base::Unretained(this));
147 140
148 base::Closure notify_callback = base::Bind(&GesturePrefsObserver::Notify, 141 base::Closure notify_callback = base::Bind(&GesturePrefsObserver::Notify,
149 base::Unretained(this)); 142 base::Unretained(this));
150 143
151 for (size_t i = 0; i < arraysize(kPrefsToObserve); ++i) 144 for (size_t i = 0; i < arraysize(kPrefsToObserve); ++i)
152 registrar_.Add(kPrefsToObserve[i], callback); 145 registrar_.Add(kPrefsToObserve[i], callback);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 GestureConfiguration::rail_start_proportion(), 421 GestureConfiguration::rail_start_proportion(),
429 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 422 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
430 registry->RegisterDoublePref( 423 registry->RegisterDoublePref(
431 prefs::kScrollPredictionSeconds, 424 prefs::kScrollPredictionSeconds,
432 GestureConfiguration::scroll_prediction_seconds(), 425 GestureConfiguration::scroll_prediction_seconds(),
433 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 426 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
434 registry->RegisterIntegerPref( 427 registry->RegisterIntegerPref(
435 prefs::kShowPressDelayInMS, 428 prefs::kShowPressDelayInMS,
436 GestureConfiguration::show_press_delay_in_ms(), 429 GestureConfiguration::show_press_delay_in_ms(),
437 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 430 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
438
439 // Register for migration.
440 registry->RegisterIntegerPref(
441 kMinScrollSuccessiveVelocityEvents,
442 0,
443 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
444
445 RegisterOverscrollPrefs(registry); 431 RegisterOverscrollPrefs(registry);
446 RegisterFlingCurveParameters(registry); 432 RegisterFlingCurveParameters(registry);
447 } 433 }
448 434
449 bool 435 bool
450 GesturePrefsObserverFactoryAura::ServiceIsCreatedWithBrowserContext() const { 436 GesturePrefsObserverFactoryAura::ServiceIsCreatedWithBrowserContext() const {
451 // Create the observer as soon as the profile is created. 437 // Create the observer as soon as the profile is created.
452 return true; 438 return true;
453 } 439 }
454 440
455 content::BrowserContext* 441 content::BrowserContext*
456 GesturePrefsObserverFactoryAura::GetBrowserContextToUse( 442 GesturePrefsObserverFactoryAura::GetBrowserContextToUse(
457 content::BrowserContext* context) const { 443 content::BrowserContext* context) const {
458 // Use same gesture preferences on incognito windows. 444 // Use same gesture preferences on incognito windows.
459 return chrome::GetBrowserContextRedirectedInIncognito(context); 445 return chrome::GetBrowserContextRedirectedInIncognito(context);
460 } 446 }
461 447
462 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { 448 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const {
463 // Some tests replace the PrefService of the TestingProfile after the 449 // Some tests replace the PrefService of the TestingProfile after the
464 // GesturePrefsObserver has been created, which makes Shutdown() 450 // GesturePrefsObserver has been created, which makes Shutdown()
465 // remove the registrar from a non-existent PrefService. 451 // remove the registrar from a non-existent PrefService.
466 return true; 452 return true;
467 } 453 }
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