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/observer_list.h" | |
13 #include "base/prefs/json_pref_store.h" | |
14 #include "base/prefs/pref_change_registrar.h" | |
15 #include "base/prefs/pref_service.h" | |
16 #include "base/prefs/pref_store.h" | |
17 #include "content/public/browser/host_zoom_map.h" | |
18 | |
19 namespace chrome { | |
20 | |
21 // A class to implement the interface between the zoom levels (default and | |
22 // per-host) and Chrome's preference persistence system. | |
23 // Finally, the prefs are also updated in response to zoom events | |
24 // from HostZoomMap. | |
battre
2014/10/06 14:33:51
Can you work on the comment to better express what
wjmaclean
2014/10/06 16:58:13
Done.
| |
25 class ChromeZoomLevelPrefs { | |
26 public: | |
27 typedef base::CallbackList<void(void)>::Subscription | |
28 DefaultZoomLevelSubscription; | |
29 | |
30 // Exposed as static function for testing. | |
31 static std::string GetHash(const base::FilePath& relative_path); | |
32 | |
33 // Initialize the pref_service and the profile_path via the constructor, | |
34 // as these concepts won't be available in the content base class | |
35 // (to be added later) which will define the InitPrefsAndCopyToHostZoomMap | |
36 // interface. |pref_service_| must outlive this class. | |
37 ChromeZoomLevelPrefs(PrefService* pref_service, | |
38 const base::FilePath& profile_path); | |
39 virtual ~ChromeZoomLevelPrefs(); | |
40 | |
41 virtual void InitPrefsAndCopyToHostZoomMap( | |
42 const base::FilePath& partition_path, | |
43 content::HostZoomMap* host_zoom_map); | |
44 | |
45 void SetDefaultZoomLevelPref(double level); | |
battre
2014/10/06 14:33:51
Currently both ChromeZoomLevelPrefs and HostZoomMa
wjmaclean
2014/10/06 16:58:13
It is my understanding that the preferences are tr
| |
46 double GetDefaultZoomLevelPref(); | |
battre
2014/10/06 14:33:51
const
wjmaclean
2014/10/06 16:58:13
Done.
| |
47 scoped_ptr<DefaultZoomLevelSubscription> RegisterDefaultZoomLevelCallback( | |
48 const base::Closure& callback); | |
49 | |
50 private: | |
51 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); | |
battre
2014/10/06 14:33:51
Please add a comment, who calls this and what it d
wjmaclean
2014/10/06 16:58:13
Done.
| |
52 | |
53 PrefService* pref_service_; | |
54 base::FilePath profile_path_; | |
55 content::HostZoomMap* host_zoom_map_; | |
56 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; | |
57 std::string partition_key_; | |
58 base::CallbackList<void(void)> default_zoom_changed_callbacks_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelPrefs); | |
61 }; | |
62 | |
63 } // namespace chrome | |
64 | |
65 #endif // CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_ | |
OLD | NEW |