Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: chrome/browser/ui/zoom/chrome_zoom_level_prefs.h

Issue 769593003: Move ZoomObserver, ZoomController and ZoomEventManager to components/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove obsolete defines in build files. Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_ 5 #ifndef CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_
6 #define CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_ 6 #define CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list.h" 13 #include "base/observer_list.h"
14 #include "base/prefs/json_pref_store.h" 14 #include "base/prefs/json_pref_store.h"
15 #include "base/prefs/pref_change_registrar.h" 15 #include "base/prefs/pref_change_registrar.h"
16 #include "base/prefs/pref_service.h" 16 #include "base/prefs/pref_service.h"
17 #include "base/prefs/pref_store.h" 17 #include "base/prefs/pref_store.h"
18 #include "content/public/browser/host_zoom_map.h" 18 #include "content/public/browser/host_zoom_map.h"
19 #include "content/public/browser/zoom_level_delegate.h" 19 #include "content/public/browser/zoom_level_delegate.h"
20 20
21 class ZoomEventManager;
22
23 namespace base { 21 namespace base {
24 class DictionaryValue; 22 class DictionaryValue;
25 } 23 }
26 24
25 namespace ui_zoom {
26 class ZoomEventManager;
27 }
28
27 namespace chrome { 29 namespace chrome {
28 30
29 // A class to manage per-partition default and per-host zoom levels in Chrome's 31 // A class to manage per-partition default and per-host zoom levels in Chrome's
30 // preference system. It implements an interface between the content/ zoom 32 // preference system. It implements an interface between the content/ zoom
31 // levels in HostZoomMap and Chrome's preference system. All changes 33 // levels in HostZoomMap and Chrome's preference system. All changes
32 // to the per-partition default zoom levels from chrome/ flow through this 34 // to the per-partition default zoom levels from chrome/ flow through this
33 // class. Any changes to per-host levels are updated when HostZoomMap calls 35 // class. Any changes to per-host levels are updated when HostZoomMap calls
34 // OnZoomLevelChanged. 36 // OnZoomLevelChanged.
35 class ChromeZoomLevelPrefs : public content::ZoomLevelDelegate { 37 class ChromeZoomLevelPrefs : public content::ZoomLevelDelegate {
36 public: 38 public:
37 typedef base::CallbackList<void(void)>::Subscription 39 typedef base::CallbackList<void(void)>::Subscription
38 DefaultZoomLevelSubscription; 40 DefaultZoomLevelSubscription;
39 41
40 // Initialize the pref_service and the partition_key via the constructor, 42 // Initialize the pref_service and the partition_key via the constructor,
41 // as these concepts won't be available in the content base class 43 // as these concepts won't be available in the content base class
42 // ZoomLevelDelegate, which will define the InitHostZoomMap interface. 44 // ZoomLevelDelegate, which will define the InitHostZoomMap interface.
43 // |pref_service_| must outlive this class. 45 // |pref_service_| must outlive this class.
44 ChromeZoomLevelPrefs(PrefService* pref_service, 46 ChromeZoomLevelPrefs(
45 const base::FilePath& profile_path, 47 PrefService* pref_service,
46 const base::FilePath& partition_path, 48 const base::FilePath& profile_path,
47 base::WeakPtr<ZoomEventManager> zoom_event_manager); 49 const base::FilePath& partition_path,
50 base::WeakPtr<ui_zoom::ZoomEventManager> zoom_event_manager);
48 virtual ~ChromeZoomLevelPrefs(); 51 virtual ~ChromeZoomLevelPrefs();
49 52
50 static std::string GetHashForTesting(const base::FilePath& relative_path); 53 static std::string GetHashForTesting(const base::FilePath& relative_path);
51 54
52 void SetDefaultZoomLevelPref(double level); 55 void SetDefaultZoomLevelPref(double level);
53 double GetDefaultZoomLevelPref() const; 56 double GetDefaultZoomLevelPref() const;
54 scoped_ptr<DefaultZoomLevelSubscription> RegisterDefaultZoomLevelCallback( 57 scoped_ptr<DefaultZoomLevelSubscription> RegisterDefaultZoomLevelCallback(
55 const base::Closure& callback); 58 const base::Closure& callback);
56 59
57 void ExtractPerHostZoomLevels( 60 void ExtractPerHostZoomLevels(
58 const base::DictionaryValue* host_zoom_dictionary, 61 const base::DictionaryValue* host_zoom_dictionary,
59 bool sanitize_partition_host_zoom_levels); 62 bool sanitize_partition_host_zoom_levels);
60 63
61 // content::ZoomLevelDelegate 64 // content::ZoomLevelDelegate
62 void InitHostZoomMap(content::HostZoomMap* host_zoom_map) override; 65 void InitHostZoomMap(content::HostZoomMap* host_zoom_map) override;
63 66
64 private: 67 private:
65 // This is a callback function that receives notifications from HostZoomMap 68 // This is a callback function that receives notifications from HostZoomMap
66 // when per-host zoom levels change. It is used to update the per-host 69 // when per-host zoom levels change. It is used to update the per-host
67 // zoom levels (if any) managed by this class (for its associated partition). 70 // zoom levels (if any) managed by this class (for its associated partition).
68 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); 71 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
69 72
70 PrefService* pref_service_; 73 PrefService* pref_service_;
71 base::WeakPtr<ZoomEventManager> zoom_event_manager_; 74 base::WeakPtr<ui_zoom::ZoomEventManager> zoom_event_manager_;
72 content::HostZoomMap* host_zoom_map_; 75 content::HostZoomMap* host_zoom_map_;
73 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_; 76 scoped_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
74 std::string partition_key_; 77 std::string partition_key_;
75 base::CallbackList<void(void)> default_zoom_changed_callbacks_; 78 base::CallbackList<void(void)> default_zoom_changed_callbacks_;
76 79
77 DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelPrefs); 80 DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelPrefs);
78 }; 81 };
79 82
80 } // namespace chrome 83 } // namespace chrome
81 84
82 #endif // CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_ 85 #endif // CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_PREFS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/zoom/chrome_zoom_level_otr_delegate.cc ('k') | chrome/browser/ui/zoom/chrome_zoom_level_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698