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_CHROME_ZOOM_LEVEL_PREFS_H_ | |
6 #define CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_ | |
7 | |
8 #include "base/callback.h" | |
9 #include "base/files/file_path.h" | |
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_change_registrar.h" | |
14 #include "base/prefs/pref_service.h" | |
15 #include "base/prefs/pref_store.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. | |
Bernhard Bauer
2014/10/01 15:09:14
This comment doesn't seem to be correct.
wjmaclean
2014/10/01 20:33:00
Done.
| |
22 // Finally, the prefs are also updated in response to zoom events | |
23 // from HostZoomMap. | |
24 class ChromeZoomLevelPrefs { | |
25 public: | |
26 // Initialize the pref_service and the profile_path via the constructor, | |
27 // as these concepts won't be available in the content base class | |
28 // (to be added later) which will define the InitPrefsAndCopyToHostZoomMap | |
29 // interface. | |
30 ChromeZoomLevelPrefs(PrefService* pref_service, | |
31 const base::FilePath& profile_path); | |
32 virtual ~ChromeZoomLevelPrefs(); | |
33 | |
34 virtual void InitPrefsAndCopyToHostZoomMap( | |
35 const base::FilePath& partition_path, | |
36 content::HostZoomMap* host_zoom_map); | |
37 | |
38 virtual void OnDefaultZoomLevelChanged(const std::string& key); | |
39 | |
40 void SetDefaultZoomLevel(double level); | |
41 std::string GetDefaultZoomLevelPath() const { | |
42 return default_zoom_level_path_; | |
43 } | |
44 | |
45 private: | |
46 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); | |
47 | |
48 PrefService* pref_service_; | |
49 base::FilePath profile_path_; | |
50 content::HostZoomMap* host_zoom_map_; | |
51 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; | |
52 std::string default_zoom_level_path_; | |
53 std::string partition_key_; | |
54 PrefChangeRegistrar pref_change_registrar_; | |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelPrefs); | |
57 }; | |
58 | |
59 } // namespace chrome | |
60 | |
61 #endif // CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_ | |
OLD | NEW |