summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bai <michaelbai@google.com>2014-09-12 12:46:55 -0700
committerTao Bai <michaelbai@google.com>2014-09-12 16:13:10 -0700
commit934dfe5246cd151ffd60eb6277088f58f657b81c (patch)
treece54e1027d2b591ed5567c45992481ba55673199
parent126b5b3a771fbcf1a4acd1700c8cfa22975f22df (diff)
downloadpackages_apps_Browser-934dfe5246cd151ffd60eb6277088f58f657b81c.zip
packages_apps_Browser-934dfe5246cd151ffd60eb6277088f58f657b81c.tar.gz
packages_apps_Browser-934dfe5246cd151ffd60eb6277088f58f657b81c.tar.bz2
Accept third party cookies if cookie setting is enabled by user
BUG:17474704 Change-Id: I8f9f17887cf65c1c5465b576dcf094784266b15b
-rw-r--r--src/com/android/browser/BrowserSettings.java3
-rw-r--r--src/com/android/browser/BrowserWebViewFactory.java4
-rw-r--r--src/com/android/browser/Tab.java9
3 files changed, 16 insertions, 0 deletions
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index cafd019..586db28 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -311,6 +311,9 @@ public class BrowserSettings implements OnSharedPreferenceChangeListener,
mNeedsSharedSync = false;
CookieManager.getInstance().setAcceptCookie(acceptCookies());
if (mController != null) {
+ for (Tab tab : mController.getTabs()) {
+ tab.setAcceptThirdPartyCookies(acceptCookies());
+ }
mController.setShouldShowErrorConsole(enableJavascriptConsole());
}
}
diff --git a/src/com/android/browser/BrowserWebViewFactory.java b/src/com/android/browser/BrowserWebViewFactory.java
index 1b04a57..2349c28 100644
--- a/src/com/android/browser/BrowserWebViewFactory.java
+++ b/src/com/android/browser/BrowserWebViewFactory.java
@@ -19,6 +19,7 @@ import android.content.Context;
import android.content.pm.PackageManager;
import android.util.AttributeSet;
import android.view.View;
+import android.webkit.CookieManager;
import android.webkit.WebView;
/**
@@ -66,6 +67,9 @@ public class BrowserWebViewFactory implements WebViewFactory {
final BrowserSettings s = BrowserSettings.getInstance();
s.startManagingSettings(w.getSettings());
+ CookieManager cookieManager = CookieManager.getInstance();
+ cookieManager.setAcceptThirdPartyCookies(w, cookieManager.acceptCookie());
+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
// Remote Web Debugging is always enabled, where available.
WebView.setWebContentsDebuggingEnabled(true);
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index d463045..03b0faa 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -48,6 +48,7 @@ import android.view.View;
import android.view.ViewStub;
import android.webkit.ClientCertRequest;
import android.webkit.ConsoleMessage;
+import android.webkit.CookieManager;
import android.webkit.GeolocationPermissions;
import android.webkit.GeolocationPermissions.Callback;
import android.webkit.HttpAuthHandler;
@@ -1975,4 +1976,12 @@ class Tab implements PictureListener {
setSecurityState(SecurityState.SECURITY_STATE_MIXED);
}
}
+
+ public void setAcceptThirdPartyCookies(boolean accept) {
+ CookieManager cookieManager = CookieManager.getInstance();
+ if (mMainView != null)
+ cookieManager.setAcceptThirdPartyCookies(mMainView, accept);
+ if (mSubView != null)
+ cookieManager.setAcceptThirdPartyCookies(mSubView, accept);
+ }
}