summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordfalcantara <dfalcantara@chromium.org>2015-06-29 15:57:38 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-29 22:58:18 +0000
commitd7c405657d5ec5bee5b2037cd1cd469b5eb56261 (patch)
treed9c9cda64a1dec34af44ca06f8bfc3ef48c0a92c
parentab03a1db96e35fc3d0619b1ba5830bfdfcd31c5b (diff)
downloadchromium_src-d7c405657d5ec5bee5b2037cd1cd469b5eb56261.zip
chromium_src-d7c405657d5ec5bee5b2037cd1cd469b5eb56261.tar.gz
chromium_src-d7c405657d5ec5bee5b2037cd1cd469b5eb56261.tar.bz2
Delete the DocumentWebContentsDelegate
Now that the WebContents are being paused when they are created, this stub class is no longer necessary. BUG=451453 Review URL: https://codereview.chromium.org/1216123002 Cr-Commit-Position: refs/heads/master@{#336672}
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/document/DocumentTab.java8
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/document/DocumentWebContentsDelegate.java51
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/webapps/FullScreenActivityTab.java12
-rw-r--r--chrome/browser/android/chrome_jni_registrar.cc2
-rw-r--r--chrome/browser/android/document/document_web_contents_delegate.cc61
-rw-r--r--chrome/browser/android/document/document_web_contents_delegate.h48
-rw-r--r--chrome/chrome_browser.gypi2
7 files changed, 0 insertions, 184 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentTab.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentTab.java
index 0f32153..4067e6e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentTab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentTab.java
@@ -160,14 +160,6 @@ public class DocumentTab extends ChromeTab {
*/
public class DocumentTabChromeWebContentsDelegateAndroidImpl
extends TabChromeWebContentsDelegateAndroidImpl {
- @Override
- public void webContentsCreated(WebContents sourceWebContents, long openerRenderFrameId,
- String frameName, String targetUrl, WebContents newWebContents) {
- super.webContentsCreated(sourceWebContents, openerRenderFrameId, frameName,
- targetUrl, newWebContents);
- DocumentWebContentsDelegate.getInstance().attachDelegate(newWebContents);
- }
-
/**
* TODO(dfalcantara): Remove this when DocumentActivity.getTabModelSelector()
* can return a TabModelSelector that activateContents() can use.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentWebContentsDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentWebContentsDelegate.java
deleted file mode 100644
index e47771e..0000000
--- a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentWebContentsDelegate.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.chrome.browser.document;
-
-import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid;
-import org.chromium.content_public.browser.WebContents;
-
-/**
- * Stubs out calls to the WebContentsDelegateAndroid. Attaching a WebContentsDelegateAndroid to a
- * newly created WebContents signals to Chrome that it was created properly, which is needed in
- * situations where Chrome on Android needs to create the Activity for the WebContents
- * asynchronously.
- */
-public class DocumentWebContentsDelegate extends WebContentsDelegateAndroid {
- /**
- * Singleton instance of the WebContentsDelegate. Delegates can be assigned to multiple
- * WebContents.
- */
- private static DocumentWebContentsDelegate sInstance;
-
- /**
- * Native side pointer to the stubbed WebContentsDelegate.
- */
- private long mNativePtr;
-
- /**
- * @return The Singleton instance, creating it if necessary.
- */
- public static DocumentWebContentsDelegate getInstance() {
- if (sInstance == null) sInstance = new DocumentWebContentsDelegate();
- return sInstance;
- }
-
- /**
- * Attaches the native side delegate to the native WebContents.
- * @param webContents The {@link WebContents} to attach to.
- */
- public void attachDelegate(WebContents webContents) {
- nativeAttachContents(mNativePtr, webContents);
- }
-
- private DocumentWebContentsDelegate() {
- mNativePtr = nativeInitialize();
- }
-
- private native long nativeInitialize();
- private native void nativeAttachContents(
- long nativeDocumentWebContentsDelegate, WebContents webContents);
-} \ No newline at end of file
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/FullScreenActivityTab.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/FullScreenActivityTab.java
index 6c38428..9896aee 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/FullScreenActivityTab.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/FullScreenActivityTab.java
@@ -27,10 +27,8 @@ import org.chromium.chrome.browser.contextmenu.ContextMenuHelper;
import org.chromium.chrome.browser.contextmenu.ContextMenuParams;
import org.chromium.chrome.browser.contextmenu.ContextMenuPopulator;
import org.chromium.chrome.browser.document.ChromeLauncherActivity;
-import org.chromium.chrome.browser.document.DocumentWebContentsDelegate;
import org.chromium.chrome.browser.tab.ChromeTab;
import org.chromium.chrome.browser.tabmodel.TabModel.TabLaunchType;
-import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.chrome.browser.util.StreamUtil;
import org.chromium.content_public.browser.LoadUrlParams;
import org.chromium.content_public.browser.WebContents;
@@ -338,15 +336,5 @@ public class FullScreenActivityTab extends ChromeTab {
getApplicationContext().startActivity(intent);
}
-
- @Override
- public void webContentsCreated(WebContents sourceWebContents, long openerRenderFrameId,
- String frameName, String targetUrl, WebContents newWebContents) {
- super.webContentsCreated(sourceWebContents, openerRenderFrameId, frameName,
- targetUrl, newWebContents);
- if (FeatureUtilities.isDocumentMode(mActivity)) {
- DocumentWebContentsDelegate.getInstance().attachDelegate(newWebContents);
- }
- }
}
}
diff --git a/chrome/browser/android/chrome_jni_registrar.cc b/chrome/browser/android/chrome_jni_registrar.cc
index 9aee69d..a236a13 100644
--- a/chrome/browser/android/chrome_jni_registrar.cc
+++ b/chrome/browser/android/chrome_jni_registrar.cc
@@ -30,7 +30,6 @@
#include "chrome/browser/android/contextualsearch/contextual_search_tab_helper.h"
#include "chrome/browser/android/cookies/cookies_fetcher.h"
#include "chrome/browser/android/dev_tools_server.h"
-#include "chrome/browser/android/document/document_web_contents_delegate.h"
#include "chrome/browser/android/dom_distiller/external_feedback_reporter_android.h"
#include "chrome/browser/android/download/chrome_download_delegate.h"
#include "chrome/browser/android/favicon_helper.h"
@@ -209,7 +208,6 @@ static base::android::RegistrationMethod kChromeRegisteredMethods[] = {
{"DataReductionProxyInfoBarDelegate", DataReductionProxyInfoBar::Register},
{"DataReductionProxySettings", DataReductionProxySettingsAndroid::Register},
{"DevToolsServer", RegisterDevToolsServer},
- {"DocumentWebContentsDelegate", DocumentWebContentsDelegate::Register},
{"DomDistillerServiceFactory",
dom_distiller::android::DomDistillerServiceFactoryAndroid::Register},
{"DomDistillerTabUtils", RegisterDomDistillerTabUtils},
diff --git a/chrome/browser/android/document/document_web_contents_delegate.cc b/chrome/browser/android/document/document_web_contents_delegate.cc
deleted file mode 100644
index 760720f..0000000
--- a/chrome/browser/android/document/document_web_contents_delegate.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/android/document/document_web_contents_delegate.h"
-
-#include "components/web_contents_delegate_android/web_contents_delegate_android.h"
-#include "content/public/browser/web_contents.h"
-#include "jni/DocumentWebContentsDelegate_jni.h"
-
-DocumentWebContentsDelegate::DocumentWebContentsDelegate(JNIEnv* env,
- jobject obj)
- : WebContentsDelegateAndroid(env, obj) {
-}
-
-DocumentWebContentsDelegate::~DocumentWebContentsDelegate() {
-}
-
-void DocumentWebContentsDelegate::AttachContents(JNIEnv* env,
- jobject jcaller,
- jobject jweb_contents) {
- content::WebContents* web_contents =
- content::WebContents::FromJavaWebContents(jweb_contents);
- web_contents->SetDelegate(this);
-}
-
-bool DocumentWebContentsDelegate::Register(JNIEnv* env) {
- return RegisterNativesImpl(env);
-}
-
-void DocumentWebContentsDelegate::AddNewContents(
- content::WebContents* source,
- content::WebContents* new_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture,
- bool* was_blocked) {
- NOTREACHED();
-}
-
-void DocumentWebContentsDelegate::CloseContents(content::WebContents* source) {
- NOTREACHED();
-}
-
-bool DocumentWebContentsDelegate::ShouldCreateWebContents(
- content::WebContents* web_contents,
- int route_id,
- int main_frame_route_id,
- WindowContainerType window_container_type,
- const base::string16& frame_name,
- const GURL& target_url,
- const std::string& partition_id,
- content::SessionStorageNamespace* session_storage_namespace) {
- NOTREACHED();
- return false;
-}
-
-
-static jlong Initialize(JNIEnv* env, jobject obj) {
- return reinterpret_cast<intptr_t>(new DocumentWebContentsDelegate(env, obj));
-}
diff --git a/chrome/browser/android/document/document_web_contents_delegate.h b/chrome/browser/android/document/document_web_contents_delegate.h
deleted file mode 100644
index 47abf81..0000000
--- a/chrome/browser/android/document/document_web_contents_delegate.h
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_ANDROID_DOCUMENT_DOCUMENT_WEB_CONTENTS_DELEGATE_H_
-#define CHROME_BROWSER_ANDROID_DOCUMENT_DOCUMENT_WEB_CONTENTS_DELEGATE_H_
-
-#include "components/web_contents_delegate_android/web_contents_delegate_android.h"
-
-// Stub WebContentsDelegateAndroid that is meant to be a temporary substitute
-// for a real WebContentsDelegate for the (expectedly short) period between when
-// a new WebContents is created and the new DocumentActivity/DocumentTab are
-// created and take ownership of the WebContents (which replaces this Delegate
-// with a real one). It is not meant to do anything except allow
-// WebContentsDelegateAndroid::OpenURLFromTab() to load the URL for the
-// WebContents.
-class DocumentWebContentsDelegate
- : public web_contents_delegate_android::WebContentsDelegateAndroid {
- public:
- DocumentWebContentsDelegate(JNIEnv* env, jobject obj);
- ~DocumentWebContentsDelegate() override;
-
- // Attaches this delegate to the given WebContents.
- void AttachContents(JNIEnv* env, jobject obj, jobject jweb_contents);
-
- // Registers the JNI calls.
- static bool Register(JNIEnv* env);
-
- // Overridden from WebContentsDelegate.
- void AddNewContents(content::WebContents* source,
- content::WebContents* new_contents,
- WindowOpenDisposition disposition,
- const gfx::Rect& initial_pos,
- bool user_gesture,
- bool* was_blocked) override;
- void CloseContents(content::WebContents* source) override;
- bool ShouldCreateWebContents(
- content::WebContents* web_contents,
- int route_id,
- int main_frame_route_id,
- WindowContainerType window_container_type,
- const base::string16& frame_name,
- const GURL& target_url,
- const std::string& partition_id,
- content::SessionStorageNamespace* session_storage_namespace) override;
-};
-
-#endif // CHROME_BROWSER_ANDROID_DOCUMENT_DOCUMENT_WEB_CONTENTS_DELEGATE_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index ebd8631..348260e 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -108,7 +108,6 @@
'browser/android/dev_tools_discovery_provider_android.h',
'browser/android/dev_tools_server.cc',
'browser/android/dev_tools_server.h',
- 'browser/android/document/document_web_contents_delegate.cc',
'browser/android/dom_distiller/external_feedback_reporter_android.cc',
'browser/android/dom_distiller/external_feedback_reporter_android.h',
'browser/android/download/android_download_manager_overwrite_infobar_delegate.cc',
@@ -1730,7 +1729,6 @@
'android/java/src/org/chromium/chrome/browser/cookies/CookiesFetcher.java',
'android/java/src/org/chromium/chrome/browser/DevToolsServer.java',
'android/java/src/org/chromium/chrome/browser/database/SQLiteCursor.java',
- 'android/java/src/org/chromium/chrome/browser/document/DocumentWebContentsDelegate.java',
'android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerFeedbackReporter.java',
'android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerServiceFactory.java',
'android/java/src/org/chromium/chrome/browser/dom_distiller/DomDistillerTabUtils.java',