diff --git a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SessionImpl.java b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SessionImpl.java index 82b9c112b2..32cfe6ecd5 100644 --- a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SessionImpl.java +++ b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SessionImpl.java @@ -57,6 +57,7 @@ public void onReady() { assert mTab == null; mTab = new TabImpl( mRuntime.getContainerView().getContext(), SessionImpl.this); + mSettings.setWebContents(mTab.getContentView().getWebContents()); if (mInitialUri != null) { mTab.loadUrl(mInitialUri); mInitialUri = null; diff --git a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SettingsImpl.java b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SettingsImpl.java index fdab6ab799..66e98afce1 100644 --- a/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SettingsImpl.java +++ b/app/src/common/chromium/com/igalia/wolvic/browser/api/impl/SettingsImpl.java @@ -5,6 +5,7 @@ import com.igalia.wolvic.BuildConfig; import com.igalia.wolvic.browser.api.WSessionSettings; +import org.chromium.content_public.browser.WebContents; import org.chromium.wolvic.SessionSettings; public class SettingsImpl implements WSessionSettings { @@ -123,6 +124,11 @@ public String getUserAgentOverride() { return mSessionSettings.getUserAgentOverride(); } + @Override + public void setWebContents(@Nullable WebContents webContents) { + mSessionSettings.setWebContents(webContents); + } + public String getDefaultUserAgent(int mode) { return mSessionSettings.getDefaultUserAgent(toUserAgentMode(mode)) + " Wolvic/" + BuildConfig.VERSION_NAME; } diff --git a/app/src/common/shared/com/igalia/wolvic/browser/api/WSessionSettings.java b/app/src/common/shared/com/igalia/wolvic/browser/api/WSessionSettings.java index 8987a22d16..e5394e4e43 100644 --- a/app/src/common/shared/com/igalia/wolvic/browser/api/WSessionSettings.java +++ b/app/src/common/shared/com/igalia/wolvic/browser/api/WSessionSettings.java @@ -4,6 +4,8 @@ import com.igalia.wolvic.browser.api.impl.SettingsImpl; +import org.chromium.content_public.browser.WebContents; + public interface WSessionSettings { static WSessionSettings create(boolean usePrivateMode) { @@ -167,4 +169,6 @@ static WSessionSettings create(boolean usePrivateMode) { * @return The current user agent string or null if the agent is specified by ISessionSettings#USER_AGENT_MODE} */ @Nullable String getUserAgentOverride(); + + void setWebContents(final @Nullable WebContents webContents); }