Igalia / wolvic-chromium

The official GitHub mirror of the Chromium source
https://chromium.googlesource.com/chromium/src/
BSD 3-Clause "New" or "Revised" License
11 stars 6 forks source link

Notify the creation of a new window #50

Closed svillar closed 10 months ago

svillar commented 10 months ago

The main purpouse of this PR is to add a new notification method that would allow Wolvic to create a new window on its own when certain types of navigations (like links with target=_blank) instruct the web engine to create a new window.

This was done by subclassing WebContentsDelegateAndroid into a new class WolvicWebContentsDelegate with a single abstract method that should be implemented in Wolvic. That method carries the url that should be opened in the new window.

In order to let Wolvic create the window we first must ask chromium not to create a window for it. That's done by letting the WebContents created by Chromium die (normally the delegate should take ownership of it). When that happens Chromium automatically cancels the creation of a new window. Wolvic will still however get the notification and will create the new window by itself.

The reason why we don't use the WebContents created by chromium directly in Wolvic is because the current Wolvic architecture (designed mainly to fit well with GeckoView API) does not easily allow us to reuse it for a new session/tab.

The actual fix is the last commit in the series. There are 3 precuels that fixes some already existing issues in our implementation (without them the new method don't work properly).