OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 overscroll_prefs.assign(kOverscrollPrefs, | 56 overscroll_prefs.assign(kOverscrollPrefs, |
57 kOverscrollPrefs + arraysize(kOverscrollPrefs)); | 57 kOverscrollPrefs + arraysize(kOverscrollPrefs)); |
58 } | 58 } |
59 return overscroll_prefs; | 59 return overscroll_prefs; |
60 } | 60 } |
61 | 61 |
62 // This class manages gesture configuration preferences. | 62 // This class manages gesture configuration preferences. |
63 class GesturePrefsObserver : public KeyedService { | 63 class GesturePrefsObserver : public KeyedService { |
64 public: | 64 public: |
65 explicit GesturePrefsObserver(PrefService* prefs); | 65 explicit GesturePrefsObserver(PrefService* prefs); |
66 virtual ~GesturePrefsObserver(); | 66 ~GesturePrefsObserver() override; |
67 | 67 |
68 // KeyedService implementation. | 68 // KeyedService implementation. |
69 virtual void Shutdown() override; | 69 void Shutdown() override; |
70 | 70 |
71 private: | 71 private: |
72 // Notification callback invoked when browser-side preferences | 72 // Notification callback invoked when browser-side preferences |
73 // are updated and need to be pushed into ui::GesturePreferences. | 73 // are updated and need to be pushed into ui::GesturePreferences. |
74 void Update(); | 74 void Update(); |
75 | 75 |
76 // Notification callback invoked when the fling deacceleration | 76 // Notification callback invoked when the fling deacceleration |
77 // gesture preferences are changed from chrome://gesture. | 77 // gesture preferences are changed from chrome://gesture. |
78 // Broadcasts the changes all renderers where they are used. | 78 // Broadcasts the changes all renderers where they are used. |
79 void Notify(); | 79 void Notify(); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Use same gesture preferences on incognito windows. | 246 // Use same gesture preferences on incognito windows. |
247 return chrome::GetBrowserContextRedirectedInIncognito(context); | 247 return chrome::GetBrowserContextRedirectedInIncognito(context); |
248 } | 248 } |
249 | 249 |
250 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { | 250 bool GesturePrefsObserverFactoryAura::ServiceIsNULLWhileTesting() const { |
251 // Some tests replace the PrefService of the TestingProfile after the | 251 // Some tests replace the PrefService of the TestingProfile after the |
252 // GesturePrefsObserver has been created, which makes Shutdown() | 252 // GesturePrefsObserver has been created, which makes Shutdown() |
253 // remove the registrar from a non-existent PrefService. | 253 // remove the registrar from a non-existent PrefService. |
254 return true; | 254 return true; |
255 } | 255 } |
OLD | NEW |