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

Unified Diff: chrome/browser/ui/zoom/chrome_zoom_level_prefs.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 side-by-side diff with in-line comments
Download patch
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
index 4799e23f1ccbadbca9c41d970a89f55e60bbeb4d..bae6c38156f61a27ed0f60effefcf7dd87112e98 100644
--- a/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h
+++ b/chrome/browser/ui/zoom/chrome_zoom_level_prefs.h
@@ -11,12 +11,10 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
-#include "components/prefs/json_pref_store.h"
-#include "components/prefs/pref_change_registrar.h"
+#include "chrome/browser/ui/zoom/chrome_zoom_prefs_helper.h"
#include "components/prefs/pref_service.h"
-#include "components/prefs/pref_store.h"
+#include "components/zoom/zoom_prefs_delegate.h"
#include "content/public/browser/host_zoom_map.h"
-#include "content/public/browser/zoom_level_delegate.h"
namespace base {
class DictionaryValue;
@@ -26,20 +24,23 @@ namespace zoom {
class ZoomEventManager;
}
-// A class to manage per-partition default and per-host zoom levels in Chrome's
-// preference system. It implements an interface between the content/ zoom
-// levels in HostZoomMap and Chrome's preference system. All changes
-// to the per-partition default zoom levels from chrome/ flow through this
+// A class to manage per-partition default and per-host zoom levels as well as
+// the zoom scope pref in Chrome's preference system. It implements an
+// interface to Chrome's preference system for the content/ zoom levels in
+// HostZoomMap and the zoom scope in ZoomController. All changes to the
+// per-partition default zoom levels and scope from chrome/ flow through this
// class. Any changes to per-host levels are updated when HostZoomMap calls
// OnZoomLevelChanged.
-class ChromeZoomLevelPrefs : public content::ZoomLevelDelegate {
+class ChromeZoomLevelPrefs : public zoom::ZoomPrefsDelegate {
public:
typedef base::CallbackList<void(void)>::Subscription
DefaultZoomLevelSubscription;
- // Initialize the pref_service and the partition_key via the constructor,
- // as these concepts won't be available in the content base class
- // ZoomLevelDelegate, which will define the InitHostZoomMap interface.
+ // Initialize our ChromeZoomPrefsHelper with pref_service and the partition
+ // information via this constructor, as these concepts won't be available in
+ // the content base class ZoomLevelDelegate (which will define the
+ // InitHostZoomMap interface) nor in the components class ZoomPrefsDelegate
+ // (which will define the interface for the zoom scope pref).
// |pref_service_| must outlive this class.
ChromeZoomLevelPrefs(
PrefService* pref_service,
@@ -55,25 +56,31 @@ class ChromeZoomLevelPrefs : public content::ZoomLevelDelegate {
std::unique_ptr<DefaultZoomLevelSubscription>
RegisterDefaultZoomLevelCallback(const base::Closure& callback);
+ void SetZoomScopeIsPerOriginPref(bool is_per_origin);
+
void ExtractPerHostZoomLevels(
const base::DictionaryValue* host_zoom_dictionary,
bool sanitize_partition_host_zoom_levels);
- // content::ZoomLevelDelegate
+ // zoom::ZoomPrefsDelegate
void InitHostZoomMap(content::HostZoomMap* host_zoom_map) override;
+ bool GetZoomScopeIsPerOriginPref() const override;
+ std::unique_ptr<DefaultZoomScopeSubscription>
+ RegisterDefaultZoomScopeCallback(const base::Closure& callback) override;
+
private:
// This is a callback function that receives notifications from HostZoomMap
// when per-host zoom levels change. It is used to update the per-host
// zoom levels (if any) managed by this class (for its associated partition).
void OnZoomLevelChanged(const content::HostZoomMap::ZoomLevelChange& change);
- PrefService* pref_service_;
+ ChromeZoomPrefsHelper partitioned_prefs_;
base::WeakPtr<zoom::ZoomEventManager> zoom_event_manager_;
content::HostZoomMap* host_zoom_map_;
std::unique_ptr<content::HostZoomMap::Subscription> zoom_subscription_;
- std::string partition_key_;
base::CallbackList<void(void)> default_zoom_changed_callbacks_;
+ base::CallbackList<void(void)> default_scope_changed_callbacks_;
DISALLOW_COPY_AND_ASSIGN(ChromeZoomLevelPrefs);
};
« 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