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 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); |
| 30 |
| 31 // Implement ZoomLevelPrefsStore. |
| 32 virtual void InitPrefsAndCopyToHostZoomMap( |
| 33 const base::FilePath& file_path, |
| 34 content::HostZoomMap* host_zoom_map) OVERRIDE; |
| 35 virtual PrefService* GetPrefs() OVERRIDE; |
| 36 |
| 37 // Implement PrefObserver. |
| 38 virtual void OnPrefValueChanged(const std::string& key) OVERRIDE; |
| 39 virtual void OnInitializationCompleted(bool succeeded) OVERRIDE; |
| 40 |
| 41 // TODO(wjmaclean): remove this when migration is complete. |
| 42 virtual void SetInitCallback(const base::Closure& callback); |
| 43 |
| 44 private: |
| 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 |