Index: chrome/browser/ui/zoom/chrome_zoom_level_prefs.h |
diff --git a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bdf076f882382e1cd2e894cef63b19855a757707 |
--- /dev/null |
+++ b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h |
@@ -0,0 +1,61 @@ |
+// Copyright (c) 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_ |
+#define CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_ |
+ |
+#include "base/callback.h" |
+#include "base/files/file_path.h" |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/prefs/json_pref_store.h" |
+#include "base/prefs/pref_change_registrar.h" |
+#include "base/prefs/pref_service.h" |
+#include "base/prefs/pref_store.h" |
+#include "content/public/browser/host_zoom_map.h" |
+ |
+namespace chrome { |
+ |
+// A class to implement ZoomLevelPrefsStore. It also implements |
+// PrefStore::Observer so that it can track changes to the prefs. |
Bernhard Bauer
2014/10/01 15:09:14
This comment doesn't seem to be correct.
wjmaclean
2014/10/01 20:33:00
Done.
|
+// Finally, the prefs are also updated in response to zoom events |
+// from HostZoomMap. |
+class ChromeZoomLevelPrefs { |
+ public: |
+ // Initialize the pref_service and the profile_path via the constructor, |
+ // as these concepts won't be available in the content base class |
+ // (to be added later) which will define the InitPrefsAndCopyToHostZoomMap |
+ // interface. |
+ ChromeZoomLevelPrefs(PrefService* pref_service, |
+ const base::FilePath& profile_path); |
+ virtual ~ChromeZoomLevelPrefs(); |
+ |
+ virtual void InitPrefsAndCopyToHostZoomMap( |
+ const base::FilePath& partition_path, |
+ content::HostZoomMap* host_zoom_map); |
+ |
+ virtual void OnDefaultZoomLevelChanged(const std::string& key); |
+ |
+ void SetDefaultZoomLevel(double level); |
+ std::string GetDefaultZoomLevelPath() const { |
+ return default_zoom_level_path_; |
+ } |
+ |
+ private: |
+ void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); |
+ |
+ PrefService* pref_service_; |
+ base::FilePath profile_path_; |
+ content::HostZoomMap* host_zoom_map_; |
+ scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; |
+ std::string default_zoom_level_path_; |
+ std::string partition_key_; |
+ PrefChangeRegistrar pref_change_registrar_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelPrefs); |
+}; |
+ |
+} // namespace chrome |
+ |
+#endif // CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_ |