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/macros.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/prefs/json_pref_store.h" |
| 13 #include "base/prefs/pref_store.h" |
| 14 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 15 #include "content/public/browser/host_zoom_map.h" |
| 16 |
| 17 namespace chrome { |
| 18 |
| 19 // A class to implement ZoomLevelPrefsStore. It also implements |
| 20 // PrefStore::Observer so that it can track changes to the prefs. |
| 21 // Finally, the prefs are also updated in response to zoom events |
| 22 // from HostZoomMap. |
| 23 class ZoomLevelPrefsStoreImpl : public PrefStore::Observer, |
| 24 public content::ZoomLevelPrefsStore { |
| 25 public: |
| 26 ZoomLevelPrefsStoreImpl(); |
| 27 virtual ~ZoomLevelPrefsStoreImpl(); |
| 28 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); |
| 29 |
| 30 // Implement ZoomLevelPrefsStore. |
| 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 private: |
| 41 |
| 42 scoped_refptr<JsonPrefStore> zoom_level_prefs_; |
| 43 scoped_ptr<PrefServiceSyncable> pref_service_; |
| 44 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; |
| 45 content::HostZoomMap* host_zoom_map_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(ZoomLevelPrefsStoreImpl); |
| 48 }; |
| 49 |
| 50 } // namespace chrome |
| 51 |
| 52 #endif // CHROME_BROWSER_UI_ZOOM_ZOOM_LEVEL_PREFS_STORE_IMPL_H_ |
OLD | NEW |