Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_ZOOM_ZOOM_LEVEL_PREFS_STORE_IMPL_H_ | |
| 6 #define CHROME_BROWSER_UI_ZOOM_ZOOM_LEVEL_PREFS_STORE_IMPL_H_ | |
| 7 | |
| 8 #include "content/public/browser/zoom_level_prefs_store.h" | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/prefs/json_pref_store.h" | |
| 14 #include "base/prefs/pref_store.h" | |
| 15 #include "chrome/browser/prefs/pref_service_syncable.h" | |
| 16 #include "content/public/browser/host_zoom_map.h" | |
| 17 | |
| 18 namespace chrome { | |
| 19 | |
| 20 // A class to implement ZoomLevelPrefsStore. It also implements | |
| 21 // PrefStore::Observer so that it can track changes to the prefs. | |
| 22 // Finally, the prefs are also updated in response to zoom events | |
| 23 // from HostZoomMap. | |
| 24 class ZoomLevelPrefsStoreImpl : public PrefStore::Observer, | |
| 25 public content::ZoomLevelPrefsStore { | |
| 26 public: | |
| 27 ZoomLevelPrefsStoreImpl(); | |
| 28 virtual ~ZoomLevelPrefsStoreImpl(); | |
| 29 | |
| 30 // Implement ZoomLevelPrefsStore. | |
|
Peter Kasting
2014/09/11 00:45:48
Tiny nit: I'd make these comments look like "// co
wjmaclean
2014/09/11 21:00:51
Done.
| |
| 31 virtual void InitPrefsAndCopyToHostZoomMap( | |
| 32 const base::FilePath& file_path, | |
| 33 content::HostZoomMap* host_zoom_map) OVERRIDE; | |
| 34 virtual PrefService* GetPrefs() OVERRIDE; | |
| 35 | |
| 36 // Implement PrefObserver. | |
| 37 virtual void OnPrefValueChanged(const std::string& key) OVERRIDE; | |
| 38 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE; | |
| 39 | |
| 40 // TODO(wjmaclean): remove this when migration is complete. | |
| 41 virtual void SetInitCallback(const base::Closure& callback); | |
| 42 | |
| 43 private: | |
| 44 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); | |
| 45 | |
| 46 base::Closure callback_; | |
| 47 scoped_refptr<JsonPrefStore> zoom_level_prefs_; | |
| 48 scoped_ptr<PrefServiceSyncable> pref_service_; | |
| 49 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; | |
| 50 content::HostZoomMap* host_zoom_map_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(ZoomLevelPrefsStoreImpl); | |
| 53 }; | |
| 54 | |
| 55 } // namespace chrome | |
| 56 | |
| 57 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_LEVEL_PREFS_STORE_IMPL_H_ | |
| OLD | NEW |