chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.38k stars 467 forks source link

Remember last position and size of Document Picture-in-Picture window between application restarts #3714

Open nik-sp opened 5 months ago

nik-sp commented 5 months ago

Problem

The Document Picture-in-Picture (PiP) feature doesn't remember the last position and size of the window. Each time I enable DPiP after application restart, I have to manually resize and reposition the window to my preferred settings.

Solution

I would like the CEF project to implement a feature that allows the Document Picture-in-Picture window to remember its last position and size. This means that when a user reopens the DPiP window, it should appear in the same location and with the same dimensions as when it was last closed, even after app restart.

Alternatives

As an alternative, this feature request could be reported to the Chromium project

Additional context

The current implementation is using PictureInPictureBoundsCache that stores the last position throughout the lifetime of the program, but it gets reset after program restarts

Chromium

      browser_params.initial_bounds =
          PictureInPictureWindowManager::GetInstance()
              ->CalculateInitialPictureInPictureWindowBounds(*pip_options,
                                                             display);
magreenblatt commented 5 months ago

This should be implemented in Chromium, and stored per-Profile and per-Origin. Alternately, Chromium could expose an API for setting the position and individual apps/websites could persist the value (in localStorage, etc).

nik-sp commented 5 months ago

Alternately, Chromium could expose an API for setting the position and individual apps/websites could persist the value (in localStorage, etc).

Window positioning was specifically prohibited due to security concerns:

The user agent must prevent the website from setting the position of the window in order to prevent the website from purposefully positioning the window in a location that may trick a user into thinking it is part of another page’s UI.

https://wicg.github.io/document-picture-in-picture/#positioning