Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the current WebContent in the session's settings #1350

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Loading