web_contents_zoom_observer.h 1.1 KB

123456789101112131415161718192021222324252627282930
  1. // Copyright (c) 2023 Microsoft, GmbH
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ELECTRON_SHELL_BROWSER_WEB_CONTENTS_ZOOM_OBSERVER_H_
  5. #define ELECTRON_SHELL_BROWSER_WEB_CONTENTS_ZOOM_OBSERVER_H_
  6. #include "base/observer_list_types.h"
  7. #include "shell/browser/web_contents_zoom_controller.h"
  8. namespace electron {
  9. // Interface for objects that wish to be notified of changes in
  10. // WebContentsZoomController.
  11. class WebContentsZoomObserver : public base::CheckedObserver {
  12. public:
  13. // Fired when the ZoomController is destructed. Observers should deregister
  14. // themselves from the ZoomObserver in this event handler. Note that
  15. // ZoomController::FromWebContents() returns nullptr at this point already.
  16. virtual void OnZoomControllerDestroyed(
  17. WebContentsZoomController* zoom_controller) = 0;
  18. // Notification that the zoom percentage has changed.
  19. virtual void OnZoomChanged(
  20. const WebContentsZoomController::ZoomChangedEventData& data) {}
  21. };
  22. } // namespace electron
  23. #endif // ELECTRON_SHELL_BROWSER_WEB_CONTENTS_ZOOM_OBSERVER_H_