summaryrefslogtreecommitdiffstats
path: root/content/browser/android
diff options
context:
space:
mode:
authorsimonhatch@chromium.org <simonhatch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-21 05:29:17 +0000
committersimonhatch@chromium.org <simonhatch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-21 05:29:17 +0000
commit23f41fd06e7f04a10a07c24ecfa0fe0986ef8dde (patch)
treef87eb952508cc4fdd8f0fe2a105f6ecb59d87d5f /content/browser/android
parent5655ea32677e43e353214621b9cf09fd02bc83b4 (diff)
downloadchromium_src-23f41fd06e7f04a10a07c24ecfa0fe0986ef8dde.zip
chromium_src-23f41fd06e7f04a10a07c24ecfa0fe0986ef8dde.tar.gz
chromium_src-23f41fd06e7f04a10a07c24ecfa0fe0986ef8dde.tar.bz2
Navigation transitions: Block first response until after transitions have run.
Overall idea was to use the CSRH to pause a navigation while the transition page gets a chance to load and run, then resume the navigation afterwards. If there's no navigation transition, the response is started right away. There are no callers for this yet, transition elements are sent via IPC to the TransitionNavigationManager. The CSRH will see this in OnResponseStarted, block the request immediately, and post a task to the UI thread to check if the embedder wants to handle the transition. Navigation Transitions: Design doc: https://docs.google.com/a/chromium.org/document/d/17jg1RRL3RI969cLwbKBIcoGDsPwqaEdBxafGNYGwiY4/edit# Implementation details: https://docs.google.com/a/chromium.org/document/d/1kREPtFJaeLoDKwrfmrYTD7DHCdxX1RzFBga2gNY8lyE/edit#heading=h.bng2kpmyvxq5 BUG=370696 Review URL: https://codereview.chromium.org/297973002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/android')
-rw-r--r--content/browser/android/content_view_core_impl.cc42
-rw-r--r--content/browser/android/content_view_core_impl.h14
2 files changed, 56 insertions, 0 deletions
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index fc0af4c..bb6709f 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -36,6 +36,7 @@
#include "content/browser/renderer_host/render_widget_host_view_android.h"
#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
#include "content/browser/ssl/ssl_host_state.h"
+#include "content/browser/transition_request_manager.h"
#include "content/browser/web_contents/web_contents_view_android.h"
#include "content/common/frame_messages.h"
#include "content/common/input/web_input_event_traits.h"
@@ -43,6 +44,7 @@
#include "content/common/view_messages.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "content/public/browser/browser_context.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
@@ -1569,6 +1571,28 @@ void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env,
GetWebContents()->GetRoutingID(), rect));
}
+void ContentViewCoreImpl::ResumeResponseDeferredAtStart(JNIEnv* env,
+ jobject obj) {
+ static_cast<WebContentsImpl*>(GetWebContents())->
+ ResumeResponseDeferredAtStart();
+}
+
+void ContentViewCoreImpl::SetHasPendingNavigationTransitionForTesting(
+ JNIEnv* env,
+ jobject obj) {
+ RenderFrameHost* frame = static_cast<WebContentsImpl*>(GetWebContents())->
+ GetMainFrame();
+ BrowserThread::PostTask(
+ BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(
+ &TransitionRequestManager::SetHasPendingTransitionRequest,
+ base::Unretained(TransitionRequestManager::GetInstance()),
+ frame->GetProcess()->GetID(),
+ frame->GetRoutingID(),
+ true));
+}
+
jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) {
return GetRenderProcessIdFromRenderViewHost(
web_contents_->GetRenderViewHost());
@@ -1597,6 +1621,24 @@ void ContentViewCoreImpl::RequestTextSurroundingSelection(
}
}
+void ContentViewCoreImpl::DidDeferAfterResponseStarted() {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj(java_ref_.get(env));
+ if (obj.is_null())
+ return;
+ Java_ContentViewCore_didDeferAfterResponseStarted(env, obj.obj());
+}
+
+bool ContentViewCoreImpl::WillHandleDeferAfterResponseStarted() {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
+ if (obj.is_null())
+ return false;
+
+ return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env,
+ obj.obj());
+}
+
void ContentViewCoreImpl::OnSmartClipDataExtracted(
const base::string16& result) {
JNIEnv* env = AttachCurrentThread();
diff --git a/content/browser/android/content_view_core_impl.h b/content/browser/android/content_view_core_impl.h
index 3bb1291..83a7f19 100644
--- a/content/browser/android/content_view_core_impl.h
+++ b/content/browser/android/content_view_core_impl.h
@@ -229,12 +229,26 @@ class ContentViewCoreImpl : public ContentViewCore,
void SetBackgroundOpaque(JNIEnv* env, jobject jobj, jboolean opaque);
+ // Notifies the main frame that it can continue navigation (if it was deferred
+ // immediately at first response).
+ void ResumeResponseDeferredAtStart(JNIEnv* env, jobject obj);
+
+ void SetHasPendingNavigationTransitionForTesting(JNIEnv* env, jobject obj);
+
jint GetCurrentRenderProcessId(JNIEnv* env, jobject obj);
// --------------------------------------------------------------------------
// Public methods that call to Java via JNI
// --------------------------------------------------------------------------
+ // This method is invoked when the request is deferred immediately after
+ // receiving response headers.
+ void DidDeferAfterResponseStarted();
+
+ // This method is invoked when a navigation transition is detected, to
+ // determine if the embedder intends to handle it.
+ bool WillHandleDeferAfterResponseStarted();
+
void OnSmartClipDataExtracted(const base::string16& result);
// Creates a popup menu with |items|.