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

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

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & style Created 7 years, 7 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
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"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 { prefs::kWorkspaceCyclerStopCyclerAnimationDuration, 111 { prefs::kWorkspaceCyclerStopCyclerAnimationDuration,
112 WorkspaceCyclerConfiguration::STOP_CYCLER_ANIMATION_DURATION }, 112 WorkspaceCyclerConfiguration::STOP_CYCLER_ANIMATION_DURATION },
113 }; 113 };
114 cycler_prefs.assign(kCyclerPrefs, kCyclerPrefs + arraysize(kCyclerPrefs)); 114 cycler_prefs.assign(kCyclerPrefs, kCyclerPrefs + arraysize(kCyclerPrefs));
115 } 115 }
116 return cycler_prefs; 116 return cycler_prefs;
117 } 117 }
118 #endif // USE_ASH 118 #endif // USE_ASH
119 119
120 // This class manages gesture configuration preferences. 120 // This class manages gesture configuration preferences.
121 class GesturePrefsObserver : public ProfileKeyedService { 121 class GesturePrefsObserver : public BrowserContextKeyedService {
122 public: 122 public:
123 explicit GesturePrefsObserver(PrefService* prefs); 123 explicit GesturePrefsObserver(PrefService* prefs);
124 virtual ~GesturePrefsObserver(); 124 virtual ~GesturePrefsObserver();
125 125
126 // ProfileKeyedService implementation. 126 // BrowserContextKeyedService implementation.
127 virtual void Shutdown() OVERRIDE; 127 virtual void Shutdown() OVERRIDE;
128 128
129 private: 129 private:
130 // Notification callback invoked when browser-side preferences 130 // Notification callback invoked when browser-side preferences
131 // are updated and need to be pushed into ui::GesturePreferences. 131 // are updated and need to be pushed into ui::GesturePreferences.
132 void Update(); 132 void Update();
133 133
134 // Notification callback invoked when the fling deacceleration 134 // Notification callback invoked when the fling deacceleration
135 // gesture preferences are changed from chrome://gesture. 135 // gesture preferences are changed from chrome://gesture.
136 // Broadcasts the changes all renderers where they are used. 136 // Broadcasts the changes all renderers where they are used.
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 } // namespace 363 } // namespace
364 364
365 // static 365 // static
366 GesturePrefsObserverFactoryAura* 366 GesturePrefsObserverFactoryAura*
367 GesturePrefsObserverFactoryAura::GetInstance() { 367 GesturePrefsObserverFactoryAura::GetInstance() {
368 return Singleton<GesturePrefsObserverFactoryAura>::get(); 368 return Singleton<GesturePrefsObserverFactoryAura>::get();
369 } 369 }
370 370
371 GesturePrefsObserverFactoryAura::GesturePrefsObserverFactoryAura() 371 GesturePrefsObserverFactoryAura::GesturePrefsObserverFactoryAura()
372 : ProfileKeyedServiceFactory("GesturePrefsObserverAura", 372 : BrowserContextKeyedServiceFactory(
373 ProfileDependencyManager::GetInstance()) {} 373 "GesturePrefsObserverAura",
374 BrowserContextDependencyManager::GetInstance()) {}
374 375
375 GesturePrefsObserverFactoryAura::~GesturePrefsObserverFactoryAura() {} 376 GesturePrefsObserverFactoryAura::~GesturePrefsObserverFactoryAura() {}
376 377
377 ProfileKeyedService* GesturePrefsObserverFactoryAura::BuildServiceInstanceFor( 378 BrowserContextKeyedService*
379 GesturePrefsObserverFactoryAura::BuildServiceInstanceFor(
378 content::BrowserContext* profile) const { 380 content::BrowserContext* profile) const {
379 return new GesturePrefsObserver(static_cast<Profile*>(profile)->GetPrefs()); 381 return new GesturePrefsObserver(static_cast<Profile*>(profile)->GetPrefs());
380 } 382 }
381 383
382 void GesturePrefsObserverFactoryAura::RegisterOverscrollPrefs( 384 void GesturePrefsObserverFactoryAura::RegisterOverscrollPrefs(
383 user_prefs::PrefRegistrySyncable* registry) { 385 user_prefs::PrefRegistrySyncable* registry) {
384 const std::vector<OverscrollPref>& overscroll_prefs = GetOverscrollPrefs(); 386 const std::vector<OverscrollPref>& overscroll_prefs = GetOverscrollPrefs();
385 387
386 for (size_t i = 0; i < overscroll_prefs.size(); ++i) { 388 for (size_t i = 0; i < overscroll_prefs.size(); ++i) {
387 registry->RegisterDoublePref( 389 registry->RegisterDoublePref(
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 kTouchScreenFlingAccelerationAdjustment, 563 kTouchScreenFlingAccelerationAdjustment,
562 0.0, 564 0.0,
563 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 565 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
564 566
565 RegisterOverscrollPrefs(registry); 567 RegisterOverscrollPrefs(registry);
566 RegisterFlingCurveParameters(registry); 568 RegisterFlingCurveParameters(registry);
567 RegisterImmersiveModePrefs(registry); 569 RegisterImmersiveModePrefs(registry);
568 RegisterWorkspaceCyclerPrefs(registry); 570 RegisterWorkspaceCyclerPrefs(registry);
569 } 571 }
570 572
571 bool GesturePrefsObserverFactoryAura::ServiceIsCreatedWithProfile() const { 573 bool
574 GesturePrefsObserverFactoryAura::ServiceIsCreatedWithBrowserContext() const {
572 // Create the observer as soon as the profile is created. 575 // Create the observer as soon as the profile is created.
573 return true; 576 return true;
574 } 577 }
575 578
576 content::BrowserContext* 579 content::BrowserContext*
577 GesturePrefsObserverFactoryAura::GetBrowserContextToUse( 580 GesturePrefsObserverFactoryAura::GetBrowserContextToUse(
578 content::BrowserContext* context) const { 581 content::BrowserContext* context) const {
579 // Use same gesture preferences on incognito windows. 582 // Use same gesture preferences on incognito windows.
580 return chrome::GetBrowserContextRedirectedInIncognito(context); 583 return chrome::GetBrowserContextRedirectedInIncognito(context);
581 } 584 }
582 585
583 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { 586 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const {
584 // Some tests replace the PrefService of the TestingProfile after the 587 // Some tests replace the PrefService of the TestingProfile after the
585 // GesturePrefsObserver has been created, which makes Shutdown() 588 // GesturePrefsObserver has been created, which makes Shutdown()
586 // remove the registrar from a non-existent PrefService. 589 // remove the registrar from a non-existent PrefService.
587 return true; 590 return true;
588 } 591 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698