web_contents_zoom_observer.h 1.1 KB

1234567891011121314151617181920212223242526272829
  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 "shell/browser/web_contents_zoom_controller.h"
  7. namespace electron {
  8. // Interface for objects that wish to be notified of changes in
  9. // WebContentsZoomController.
  10. class WebContentsZoomObserver : public base::CheckedObserver {
  11. public:
  12. // Fired when the ZoomController is destructed. Observers should deregister
  13. // themselves from the ZoomObserver in this event handler. Note that
  14. // ZoomController::FromWebContents() returns nullptr at this point already.
  15. virtual void OnZoomControllerDestroyed(
  16. WebContentsZoomController* zoom_controller) = 0;
  17. // Notification that the zoom percentage has changed.
  18. virtual void OnZoomChanged(
  19. const WebContentsZoomController::ZoomChangedEventData& data) {}
  20. };
  21. } // namespace electron
  22. #endif // ELECTRON_SHELL_BROWSER_WEB_CONTENTS_ZOOM_OBSERVER_H_