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

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

Issue 2630583002: Add setting to isolate zoom changes by default. (Closed)
Patch Set: ... and tell closure_compiler. Created 3 years, 10 months 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_OTR_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_OTR_DELEGATE_H_
6 #define CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_OTR_DELEGATE_H_ 6 #define CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_OTR_DELEGATE_H_
7 7
8 #include "base/files/file_path.h"
8 #include "base/macros.h" 9 #include "base/macros.h"
9 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/ui/zoom/chrome_zoom_prefs_helper.h"
13 #include "components/prefs/pref_change_registrar.h"
14 #include "components/prefs/pref_service.h"
15 #include "components/zoom/zoom_prefs_delegate.h"
11 #include "content/public/browser/host_zoom_map.h" 16 #include "content/public/browser/host_zoom_map.h"
12 #include "content/public/browser/zoom_level_delegate.h"
13 17
14 namespace zoom { 18 namespace zoom {
15 class ZoomEventManager; 19 class ZoomEventManager;
16 } 20 }
17 21
18 // This class is a light-weight version of ChromeZoomLevelPrefs and is used 22 // This class is a light-weight version of ChromeZoomLevelPrefs and is used
19 // to connect an OTR StoragePartition's HostZoomMap to the OTR profile's 23 // to connect an OTR StoragePartition's HostZoomMap to the OTR profile's
20 // ZoomEventManager. 24 // ZoomEventManager and to provide the parent profile's default zoom scope.
21 class ChromeZoomLevelOTRDelegate : public content::ZoomLevelDelegate { 25 class ChromeZoomLevelOTRDelegate : public zoom::ZoomPrefsDelegate {
22 public: 26 public:
23 ChromeZoomLevelOTRDelegate( 27 ChromeZoomLevelOTRDelegate(
28 PrefService* pref_service,
29 const base::FilePath& profile_path,
30 const base::FilePath& partition_path,
24 base::WeakPtr<zoom::ZoomEventManager> zoom_event_manager); 31 base::WeakPtr<zoom::ZoomEventManager> zoom_event_manager);
25 ~ChromeZoomLevelOTRDelegate() override; 32 ~ChromeZoomLevelOTRDelegate() override;
26 33
27 // content::ZoomLevelDelegate 34 // zoom::ZoomPrefsDelegate
28 void InitHostZoomMap(content::HostZoomMap* host_zoom_map) override; 35 void InitHostZoomMap(content::HostZoomMap* host_zoom_map) override;
29 36
37 bool GetZoomScopeIsPerOriginPref() const override;
38 std::unique_ptr<DefaultZoomScopeSubscription>
39 RegisterDefaultZoomScopeCallback(const base::Closure& callback) override;
40
30 private: 41 private:
31 // This is a callback function that receives notifications from HostZoomMap 42 // This is a callback function that receives notifications from HostZoomMap
32 // when per-host zoom levels change. It is used to update the per-host 43 // when per-host zoom levels change. It is used to update the per-host
33 // zoom levels (if any) managed by this class (for its associated partition). 44 // zoom levels (if any) managed by this class (for its associated partition).
34 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change); 45 void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
35 46
47 void OnParentScopeChanged();
48
49 ChromeZoomPrefsHelper partitioned_prefs_;
36 base::WeakPtr<zoom::ZoomEventManager> zoom_event_manager_; 50 base::WeakPtr<zoom::ZoomEventManager> zoom_event_manager_;
37 content::HostZoomMap* host_zoom_map_; 51 content::HostZoomMap* host_zoom_map_;
38 std::unique_ptr<content::HostZoomMap::Subscription> zoom_subscription_; 52 std::unique_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
53 base::CallbackList<void(void)> default_scope_changed_callbacks_;
54 bool last_scope_was_per_origin_;
55 PrefChangeRegistrar pref_registrar_;
39 56
40 DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelOTRDelegate); 57 DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelOTRDelegate);
41 }; 58 };
42 59
43 #endif // CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_OTR_DELEGATE_H_ 60 #endif // CHROME_BROWSER_UI_ZOOM_CHROME_ZOOM_LEVEL_OTR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698