Remove incognito parameter from AwContents

It is always false and not planned to be supported

BUG=


Review URL: https://chromiumcodereview.appspot.com/11785011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175887 0039d316-1c4b-4281-b951-d872f2087c98
parent fef31643
...@@ -262,18 +262,27 @@ public class AwContents { ...@@ -262,18 +262,27 @@ public class AwContents {
} }
} }
// TODO(kristianm): Delete this when privateBrowsing parameter is removed in Android
public AwContents(ViewGroup containerView,
ContentViewCore.InternalAccessDelegate internalAccessAdapter,
AwContentsClient contentsClient,
NativeWindow nativeWindow, boolean privateBrowsing,
boolean isAccessFromFileURLsGrantedByDefault) {
this(containerView, internalAccessAdapter, contentsClient, nativeWindow,
isAccessFromFileURLsGrantedByDefault);
}
/** /**
* @param containerView the view-hierarchy item this object will be bound to. * @param containerView the view-hierarchy item this object will be bound to.
* @param internalAccessAdapter to access private methods on containerView. * @param internalAccessAdapter to access private methods on containerView.
* @param contentsClient will receive API callbacks from this WebView Contents * @param contentsClient will receive API callbacks from this WebView Contents
* @param privateBrowsing whether this is a private browsing instance of WebView.
* @param isAccessFromFileURLsGrantedByDefault passed to ContentViewCore.initialize. * @param isAccessFromFileURLsGrantedByDefault passed to ContentViewCore.initialize.
* TODO(benm): Remove the nativeWindow parameter. * TODO(benm): Remove the nativeWindow parameter.
*/ */
public AwContents(ViewGroup containerView, public AwContents(ViewGroup containerView,
ContentViewCore.InternalAccessDelegate internalAccessAdapter, ContentViewCore.InternalAccessDelegate internalAccessAdapter,
AwContentsClient contentsClient, AwContentsClient contentsClient,
NativeWindow nativeWindow, boolean privateBrowsing, NativeWindow nativeWindow,
boolean isAccessFromFileURLsGrantedByDefault) { boolean isAccessFromFileURLsGrantedByDefault) {
mContainerView = containerView; mContainerView = containerView;
mInternalAccessAdapter = internalAccessAdapter; mInternalAccessAdapter = internalAccessAdapter;
...@@ -281,7 +290,7 @@ public class AwContents { ...@@ -281,7 +290,7 @@ public class AwContents {
// setup performs process initialisation work needed by AwContents. // setup performs process initialisation work needed by AwContents.
mContentViewCore = new ContentViewCore(containerView.getContext(), mContentViewCore = new ContentViewCore(containerView.getContext(),
ContentViewCore.PERSONALITY_VIEW); ContentViewCore.PERSONALITY_VIEW);
mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate(), privateBrowsing); mNativeAwContents = nativeInit(contentsClient.getWebContentsDelegate());
mContentsClient = contentsClient; mContentsClient = contentsClient;
mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNativeAwContents)); mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNativeAwContents));
mClientCallbackHandler = new ClientCallbackHandler(); mClientCallbackHandler = new ClientCallbackHandler();
...@@ -934,8 +943,7 @@ public class AwContents { ...@@ -934,8 +943,7 @@ public class AwContents {
// Native methods // Native methods
//-------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------
private native int nativeInit(AwWebContentsDelegate webViewWebContentsDelegate, private native int nativeInit(AwWebContentsDelegate webViewWebContentsDelegate);
boolean privateBrowsing);
private static native void nativeDestroy(int nativeAwContents); private static native void nativeDestroy(int nativeAwContents);
private static native void nativeSetAwDrawSWFunctionTable(int functionTablePointer); private static native void nativeSetAwDrawSWFunctionTable(int functionTablePointer);
private static native int nativeGetAwDrawGLFunction(); private static native int nativeGetAwDrawGLFunction();
......
...@@ -38,8 +38,6 @@ public class AndroidWebViewTestBase ...@@ -38,8 +38,6 @@ public class AndroidWebViewTestBase
extends ActivityInstrumentationTestCase2<AndroidWebViewTestRunnerActivity> { extends ActivityInstrumentationTestCase2<AndroidWebViewTestRunnerActivity> {
protected static int WAIT_TIMEOUT_SECONDS = 15; protected static int WAIT_TIMEOUT_SECONDS = 15;
private static final int CHECK_INTERVAL = 100; private static final int CHECK_INTERVAL = 100;
protected static final boolean NORMAL_VIEW = false;
protected static final boolean INCOGNITO_VIEW = true;
public AndroidWebViewTestBase() { public AndroidWebViewTestBase() {
super(AndroidWebViewTestRunnerActivity.class); super(AndroidWebViewTestRunnerActivity.class);
...@@ -202,19 +200,18 @@ public class AndroidWebViewTestBase ...@@ -202,19 +200,18 @@ public class AndroidWebViewTestBase
}); });
} }
protected AwTestContainerView createAwTestContainerView(final boolean incognito, protected AwTestContainerView createAwTestContainerView(
final AwContentsClient awContentsClient) { final AwContentsClient awContentsClient) {
return createAwTestContainerView(incognito, new AwTestContainerView(getActivity()), return createAwTestContainerView(new AwTestContainerView(getActivity()),
awContentsClient); awContentsClient);
} }
protected AwTestContainerView createAwTestContainerView(final boolean incognito, protected AwTestContainerView createAwTestContainerView(
final AwTestContainerView testContainerView, final AwTestContainerView testContainerView,
final AwContentsClient awContentsClient) { final AwContentsClient awContentsClient) {
testContainerView.initialize(new AwContents(testContainerView, testContainerView.initialize(new AwContents(testContainerView,
testContainerView.getInternalAccessDelegate(), testContainerView.getInternalAccessDelegate(),
awContentsClient, new ActivityNativeWindow(getActivity()), awContentsClient, new ActivityNativeWindow(getActivity()), false));
incognito, false));
getActivity().addView(testContainerView); getActivity().addView(testContainerView);
testContainerView.requestFocus(); testContainerView.requestFocus();
return testContainerView; return testContainerView;
...@@ -222,19 +219,12 @@ public class AndroidWebViewTestBase ...@@ -222,19 +219,12 @@ public class AndroidWebViewTestBase
protected AwTestContainerView createAwTestContainerViewOnMainSync( protected AwTestContainerView createAwTestContainerViewOnMainSync(
final AwContentsClient client) throws Exception { final AwContentsClient client) throws Exception {
return createAwTestContainerViewOnMainSync(NORMAL_VIEW, client);
}
protected AwTestContainerView createAwTestContainerViewOnMainSync(
final boolean incognito,
final AwContentsClient client) throws Exception {
final AtomicReference<AwTestContainerView> testContainerView = final AtomicReference<AwTestContainerView> testContainerView =
new AtomicReference<AwTestContainerView>(); new AtomicReference<AwTestContainerView>();
final Context context = getActivity();
getInstrumentation().runOnMainSync(new Runnable() { getInstrumentation().runOnMainSync(new Runnable() {
@Override @Override
public void run() { public void run() {
testContainerView.set(createAwTestContainerView(incognito, client)); testContainerView.set(createAwTestContainerView(client));
} }
}); });
return testContainerView.get(); return testContainerView.get();
......
...@@ -28,6 +28,7 @@ public class ArchiveTest extends AndroidWebViewTestBase { ...@@ -28,6 +28,7 @@ public class ArchiveTest extends AndroidWebViewTestBase {
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp();
mTestContainerView = createAwTestContainerViewOnMainSync(mContentsClient); mTestContainerView = createAwTestContainerViewOnMainSync(mContentsClient);
} }
......
...@@ -43,7 +43,7 @@ public class AwContentsTest extends AndroidWebViewTestBase { ...@@ -43,7 +43,7 @@ public class AwContentsTest extends AndroidWebViewTestBase {
@UiThreadTest @UiThreadTest
public void testCreateDestroy() throws Throwable { public void testCreateDestroy() throws Throwable {
// NOTE this test runs on UI thread, so we cannot call any async methods. // NOTE this test runs on UI thread, so we cannot call any async methods.
createAwTestContainerView(false, mContentsClient).getAwContents().destroy(); createAwTestContainerView(mContentsClient).getAwContents().destroy();
} }
private int callDocumentHasImagesSync(final AwContents awContents) private int callDocumentHasImagesSync(final AwContents awContents)
...@@ -98,7 +98,7 @@ public class AwContentsTest extends AndroidWebViewTestBase { ...@@ -98,7 +98,7 @@ public class AwContentsTest extends AndroidWebViewTestBase {
public void testClearCacheMemoryAndDisk() throws Throwable { public void testClearCacheMemoryAndDisk() throws Throwable {
final TestAwContentsClient contentClient = new TestAwContentsClient(); final TestAwContentsClient contentClient = new TestAwContentsClient();
final AwTestContainerView testContainer = final AwTestContainerView testContainer =
createAwTestContainerViewOnMainSync(false, contentClient); createAwTestContainerViewOnMainSync(contentClient);
final AwContents awContents = testContainer.getAwContents(); final AwContents awContents = testContainer.getAwContents();
TestWebServer webServer = null; TestWebServer webServer = null;
...@@ -151,7 +151,7 @@ public class AwContentsTest extends AndroidWebViewTestBase { ...@@ -151,7 +151,7 @@ public class AwContentsTest extends AndroidWebViewTestBase {
@Feature({"AndroidWebView"}) @Feature({"AndroidWebView"})
public void testClearCacheInQuickSuccession() throws Throwable { public void testClearCacheInQuickSuccession() throws Throwable {
final AwTestContainerView testContainer = final AwTestContainerView testContainer =
createAwTestContainerViewOnMainSync(false, new TestAwContentsClient()); createAwTestContainerViewOnMainSync(new TestAwContentsClient());
final AwContents awContents = testContainer.getAwContents(); final AwContents awContents = testContainer.getAwContents();
runTestOnUiThread(new Runnable() { runTestOnUiThread(new Runnable() {
......
...@@ -21,8 +21,7 @@ base::LazyInstance<AwBrowserDependencyFactoryImpl>::Leaky g_lazy_instance; ...@@ -21,8 +21,7 @@ base::LazyInstance<AwBrowserDependencyFactoryImpl>::Leaky g_lazy_instance;
} // namespace } // namespace
AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() { AwBrowserDependencyFactoryImpl::AwBrowserDependencyFactoryImpl() {}
}
AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {} AwBrowserDependencyFactoryImpl::~AwBrowserDependencyFactoryImpl() {}
...@@ -31,18 +30,14 @@ void AwBrowserDependencyFactoryImpl::InstallInstance() { ...@@ -31,18 +30,14 @@ void AwBrowserDependencyFactoryImpl::InstallInstance() {
SetInstance(g_lazy_instance.Pointer()); SetInstance(g_lazy_instance.Pointer());
} }
content::BrowserContext* AwBrowserDependencyFactoryImpl::GetBrowserContext( content::BrowserContext* AwBrowserDependencyFactoryImpl::GetBrowserContext() {
bool incognito) {
// TODO(boliu): Remove incognito parameter.
LOG_IF(ERROR, incognito) << "Android WebView does not support incognito mode"
<< " yet. Creating normal profile instead.";
return static_cast<AwContentBrowserClient*>( return static_cast<AwContentBrowserClient*>(
content::GetContentClient()->browser())->GetAwBrowserContext(); content::GetContentClient()->browser())->GetAwBrowserContext();
} }
WebContents* AwBrowserDependencyFactoryImpl::CreateWebContents(bool incognito) { WebContents* AwBrowserDependencyFactoryImpl::CreateWebContents() {
return content::WebContents::Create( return content::WebContents::Create(
content::WebContents::CreateParams(GetBrowserContext(incognito))); content::WebContents::CreateParams(GetBrowserContext()));
} }
} // namespace android_webview } // namespace android_webview
...@@ -28,8 +28,8 @@ class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory { ...@@ -28,8 +28,8 @@ class AwBrowserDependencyFactoryImpl : public AwBrowserDependencyFactory {
static void InstallInstance(); static void InstallInstance();
// AwBrowserDependencyFactory // AwBrowserDependencyFactory
virtual content::BrowserContext* GetBrowserContext(bool incognito) OVERRIDE; virtual content::BrowserContext* GetBrowserContext() OVERRIDE;
virtual content::WebContents* CreateWebContents(bool incognito) OVERRIDE; virtual content::WebContents* CreateWebContents() OVERRIDE;
private: private:
DISALLOW_COPY_AND_ASSIGN(AwBrowserDependencyFactoryImpl); DISALLOW_COPY_AND_ASSIGN(AwBrowserDependencyFactoryImpl);
......
...@@ -37,10 +37,10 @@ class AwBrowserDependencyFactory { ...@@ -37,10 +37,10 @@ class AwBrowserDependencyFactory {
static AwBrowserDependencyFactory* GetInstance(); static AwBrowserDependencyFactory* GetInstance();
// Returns the current browser context based on the specified mode. // Returns the current browser context based on the specified mode.
virtual content::BrowserContext* GetBrowserContext(bool incognito) = 0; virtual content::BrowserContext* GetBrowserContext() = 0;
// Constructs and returns ownership of a WebContents instance. // Constructs and returns ownership of a WebContents instance.
virtual content::WebContents* CreateWebContents(bool incognito) = 0; virtual content::WebContents* CreateWebContents() = 0;
protected: protected:
AwBrowserDependencyFactory(); AwBrowserDependencyFactory();
......
...@@ -114,8 +114,7 @@ AwContents* AwContents::FromWebContents(WebContents* web_contents) { ...@@ -114,8 +114,7 @@ AwContents* AwContents::FromWebContents(WebContents* web_contents) {
AwContents::AwContents(JNIEnv* env, AwContents::AwContents(JNIEnv* env,
jobject obj, jobject obj,
jobject web_contents_delegate, jobject web_contents_delegate)
bool private_browsing)
: java_ref_(env, obj), : java_ref_(env, obj),
web_contents_delegate_( web_contents_delegate_(
new AwWebContentsDelegate(env, web_contents_delegate)), new AwWebContentsDelegate(env, web_contents_delegate)),
...@@ -130,7 +129,7 @@ AwContents::AwContents(JNIEnv* env, ...@@ -130,7 +129,7 @@ AwContents::AwContents(JNIEnv* env,
// TODO(joth): rather than create and set the WebContents here, expose the // TODO(joth): rather than create and set the WebContents here, expose the
// factory method to java side and have that orchestrate the construction // factory method to java side and have that orchestrate the construction
// order. // order.
SetWebContents(dependency_factory->CreateWebContents(private_browsing)); SetWebContents(dependency_factory->CreateWebContents());
} }
void AwContents::ResetCompositor() { void AwContents::ResetCompositor() {
...@@ -606,10 +605,8 @@ void AwContents::SetInterceptNavigationDelegate(JNIEnv* env, ...@@ -606,10 +605,8 @@ void AwContents::SetInterceptNavigationDelegate(JNIEnv* env,
static jint Init(JNIEnv* env, static jint Init(JNIEnv* env,
jobject obj, jobject obj,
jobject web_contents_delegate, jobject web_contents_delegate) {
jboolean private_browsing) { AwContents* tab = new AwContents(env, obj, web_contents_delegate);
AwContents* tab = new AwContents(env, obj, web_contents_delegate,
private_browsing);
return reinterpret_cast<jint>(tab); return reinterpret_cast<jint>(tab);
} }
......
...@@ -47,8 +47,7 @@ class AwContents : public FindHelper::Listener, ...@@ -47,8 +47,7 @@ class AwContents : public FindHelper::Listener,
AwContents(JNIEnv* env, AwContents(JNIEnv* env,
jobject obj, jobject obj,
jobject web_contents_delegate, jobject web_contents_delegate);
bool private_browsing);
virtual ~AwContents(); virtual ~AwContents();
void DrawGL(AwDrawGLInfo* draw_info); void DrawGL(AwDrawGLInfo* draw_info);
......
...@@ -32,7 +32,6 @@ M C CSM: Shouldn't use synchronized method, please narrow down the synchronizati ...@@ -32,7 +32,6 @@ M C CSM: Shouldn't use synchronized method, please narrow down the synchronizati
M C CST: Shouldn't use synchronized(this), please narrow down the synchronization scope. At HttpAuthDatabase.java M C CST: Shouldn't use synchronized(this), please narrow down the synchronization scope. At HttpAuthDatabase.java
M C CST: Shouldn't use synchronized(this), please narrow down the synchronization scope. At SimpleSynchronizedThis.java M C CST: Shouldn't use synchronized(this), please narrow down the synchronization scope. At SimpleSynchronizedThis.java
M C IJU: TestCase org.chromium.android_webview.test.AndroidWebViewTestBase defines setUp that doesn't call super.setUp() At AndroidWebViewTestBase.java M C IJU: TestCase org.chromium.android_webview.test.AndroidWebViewTestBase defines setUp that doesn't call super.setUp() At AndroidWebViewTestBase.java
M C IJU: TestCase org.chromium.android_webview.test.ArchiveTest defines setUp that doesn't call super.setUp() At ArchiveTest.java
M C IJU: TestCase org.chromium.android_webview.test.HttpAuthDatabaseTest defines setUp that doesn't call super.setUp() At HttpAuthDatabaseTest.java M C IJU: TestCase org.chromium.android_webview.test.HttpAuthDatabaseTest defines setUp that doesn't call super.setUp() At HttpAuthDatabaseTest.java
M C IJU: TestCase org.chromium.android_webview.test.HttpAuthDatabaseTest defines tearDown that doesn't call super.tearDown() At HttpAuthDatabaseTest.java M C IJU: TestCase org.chromium.android_webview.test.HttpAuthDatabaseTest defines tearDown that doesn't call super.tearDown() At HttpAuthDatabaseTest.java
M C IJU: TestCase org.chromium.chrome.testshell.ProviderBookmarkNodeTest defines setUp that doesn't call super.setUp() At ProviderBookmarkNodeTest.java M C IJU: TestCase org.chromium.chrome.testshell.ProviderBookmarkNodeTest defines setUp that doesn't call super.setUp() At ProviderBookmarkNodeTest.java
...@@ -65,7 +64,6 @@ M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$7. ...@@ -65,7 +64,6 @@ M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$7.
M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$8.method2() defined in anonymous class At JavaBridgeBasicsTest.java M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$8.method2() defined in anonymous class At JavaBridgeBasicsTest.java
M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$9.method() defined in anonymous class At JavaBridgeBasicsTest.java M C UMAC: Uncallable method org.chromium.content.browser.JavaBridgeBasicsTest$9.method() defined in anonymous class At JavaBridgeBasicsTest.java
M C USELESS_STRING: Invocation of toString on certChain in org.chromium.net.X509Util.verifyServerCertificates(byte[][], String) At X509Util.java M C USELESS_STRING: Invocation of toString on certChain in org.chromium.net.X509Util.verifyServerCertificates(byte[][], String) At X509Util.java
M D DLS: Dead store to context in org.chromium.android_webview.test.AndroidWebViewTestBase.createAwTestContainerViewOnMainSync(boolean, AwContentsClient) At AndroidWebViewTestBase.java
M D DLS: Dead store to eventTime in org.chromium.content.browser.LongPressDetectorTest$1.run() At LongPressDetectorTest.java M D DLS: Dead store to eventTime in org.chromium.content.browser.LongPressDetectorTest$1.run() At LongPressDetectorTest.java
M D DLS: Dead store to prevEditableLength in org.chromium.content.browser.ImeAdapter$AdapterInputConnection.setEditableText(String, int, int, int, int) At ImeAdapter.java M D DLS: Dead store to prevEditableLength in org.chromium.content.browser.ImeAdapter$AdapterInputConnection.setEditableText(String, int, int, int, int) At ImeAdapter.java
M D DLS: Dead store to testUrl in org.chromium.android_webview.test.ClientOnPageFinishedTest.testOnPageFinishedNotCalledForValidSubresources() At ClientOnPageFinishedTest.java M D DLS: Dead store to testUrl in org.chromium.android_webview.test.ClientOnPageFinishedTest.testOnPageFinishedNotCalledForValidSubresources() At ClientOnPageFinishedTest.java
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment