mirror of
https://github.com/electron/electron.git
synced 2026-01-08 07:04:01 -05:00
* chore: bump chromium in DEPS to 143.0.7489.0 * chore: update add_didinstallconditionalfeatures.patch no manual changes; patch applied with fuzz * chore: update allow_in-process_windows_to_have_different_web_prefs.patch patch reapplied manually due to context shear Remove BackForwardTransitions flag | https://chromium-review.googlesource.com/c/chromium/src/+/7022596 * chore: update process_singleton.patch patch reapplied manually due to context shear Use an empty prefix for socket temporary directory. | https://chromium-review.googlesource.com/c/chromium/src/+/7062192 * chore: update add_electron_deps_to_license_credits_file.patch no manual changes; patch applied with fuzz * chore: update expose_ripemd160.patch Apply modernize-use-nullptr fixes in all .cc files | https://boringssl-review.googlesource.com/c/boringssl/+/83067 * chore: update feat_expose_several_extra_cipher_functions.patch Apply modernize-use-nullptr fixes in all .cc files | https://boringssl-review.googlesource.com/c/boringssl/+/83067 * Pass Bus::Options by value with std::move. | https://chromium-review.googlesource.com/c/chromium/src/+/7056670 * chore: update patches * Remove some includes of base/callback_list.h | https://chromium-review.googlesource.com/c/chromium/src/+/7055621 * chore: run gen-libc++-filenames.js --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
66 lines
2.2 KiB
C++
66 lines
2.2 KiB
C++
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef ELECTRON_SHELL_BROWSER_ZOOM_LEVEL_DELEGATE_H_
|
|
#define ELECTRON_SHELL_BROWSER_ZOOM_LEVEL_DELEGATE_H_
|
|
|
|
#include <string>
|
|
|
|
#include "base/callback_list.h"
|
|
#include "base/memory/raw_ptr.h"
|
|
#include "base/values.h"
|
|
#include "content/public/browser/host_zoom_map.h"
|
|
#include "content/public/browser/zoom_level_delegate.h"
|
|
|
|
namespace base {
|
|
class FilePath;
|
|
} // namespace base
|
|
|
|
class PrefService;
|
|
class PrefRegistrySimple;
|
|
|
|
namespace electron {
|
|
|
|
// A class to manage per-partition default and per-host zoom levels.
|
|
// It implements an interface between the content/ zoom
|
|
// levels in HostZoomMap and preference system. All changes
|
|
// to the per-partition default zoom levels flow through this
|
|
// class. Any changes to per-host levels are updated when HostZoomMap calls
|
|
// OnZoomLevelChanged.
|
|
class ZoomLevelDelegate : public content::ZoomLevelDelegate {
|
|
public:
|
|
static void RegisterPrefs(PrefRegistrySimple* pref_registry);
|
|
|
|
ZoomLevelDelegate(PrefService* pref_service,
|
|
const base::FilePath& partition_path);
|
|
~ZoomLevelDelegate() override;
|
|
|
|
// disable copy
|
|
ZoomLevelDelegate(const ZoomLevelDelegate&) = delete;
|
|
ZoomLevelDelegate& operator=(const ZoomLevelDelegate&) = delete;
|
|
|
|
void SetDefaultZoomLevelPref(double level);
|
|
double GetDefaultZoomLevelPref() const;
|
|
|
|
// content::ZoomLevelDelegate:
|
|
void InitHostZoomMap(content::HostZoomMap* host_zoom_map) override;
|
|
|
|
private:
|
|
void ExtractPerHostZoomLevels(const base::Value::Dict& host_zoom_dictionary);
|
|
|
|
// 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);
|
|
|
|
raw_ptr<PrefService> pref_service_;
|
|
raw_ptr<content::HostZoomMap> host_zoom_map_ = nullptr;
|
|
base::CallbackListSubscription zoom_subscription_;
|
|
std::string partition_key_;
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // ELECTRON_SHELL_BROWSER_ZOOM_LEVEL_DELEGATE_H_
|