Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 435833002: Navigation transitions: Plumb data from the outgoing renderer to the incoming renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 1507
1508 void ContentViewCoreImpl::SetHasPendingNavigationTransitionForTesting( 1508 void ContentViewCoreImpl::SetHasPendingNavigationTransitionForTesting(
1509 JNIEnv* env, 1509 JNIEnv* env,
1510 jobject obj) { 1510 jobject obj) {
1511 RenderFrameHost* frame = static_cast<WebContentsImpl*>(GetWebContents())-> 1511 RenderFrameHost* frame = static_cast<WebContentsImpl*>(GetWebContents())->
1512 GetMainFrame(); 1512 GetMainFrame();
1513 BrowserThread::PostTask( 1513 BrowserThread::PostTask(
1514 BrowserThread::IO, 1514 BrowserThread::IO,
1515 FROM_HERE, 1515 FROM_HERE,
1516 base::Bind( 1516 base::Bind(
1517 &TransitionRequestManager::SetHasPendingTransitionRequest, 1517 &TransitionRequestManager::AddPendingTransitionRequestData,
1518 base::Unretained(TransitionRequestManager::GetInstance()), 1518 base::Unretained(TransitionRequestManager::GetInstance()),
1519 frame->GetProcess()->GetID(), 1519 frame->GetProcess()->GetID(),
1520 frame->GetRoutingID(), 1520 frame->GetRoutingID(),
1521 true)); 1521 "*", "", ""));
1522 } 1522 }
1523 1523
1524 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { 1524 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) {
1525 return GetRenderProcessIdFromRenderViewHost( 1525 return GetRenderProcessIdFromRenderViewHost(
1526 web_contents_->GetRenderViewHost()); 1526 web_contents_->GetRenderViewHost());
1527 } 1527 }
1528 1528
1529 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj, 1529 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj,
1530 jboolean opaque) { 1530 jboolean opaque) {
1531 if (GetRenderWidgetHostViewAndroid()) 1531 if (GetRenderWidgetHostViewAndroid())
1532 GetRenderWidgetHostViewAndroid()->SetBackgroundOpaque(opaque); 1532 GetRenderWidgetHostViewAndroid()->SetBackgroundOpaque(opaque);
1533 } 1533 }
1534 1534
1535 void ContentViewCoreImpl::SetupTransitionView(
1536 JNIEnv* env, jobject jobj, jstring markup) {
1537 if (!GetWebContents()) return;
1538 GetWebContents()->GetMainFrame()->Send(new FrameMsg_SetupTransitionView(
1539 GetWebContents()->GetMainFrame()->GetRoutingID(),
1540 ConvertJavaStringToUTF8(env, markup)));
1541 }
1542
1543 void ContentViewCoreImpl::BeginExitTransition(
1544 JNIEnv* env, jobject jobj, jstring css_selector) {
1545 if (!GetWebContents()) return;
1546 GetWebContents()->GetMainFrame()->Send(new FrameMsg_BeginExitTransition(
1547 GetWebContents()->GetMainFrame()->GetRoutingID(),
1548 ConvertJavaStringToUTF8(env, css_selector)));
1549 }
1550
1535 void ContentViewCoreImpl::RequestTextSurroundingSelection( 1551 void ContentViewCoreImpl::RequestTextSurroundingSelection(
1536 int max_length, 1552 int max_length,
1537 const base::Callback< 1553 const base::Callback<
1538 void(const base::string16& content, int start_offset, int end_offset)>& 1554 void(const base::string16& content, int start_offset, int end_offset)>&
1539 callback) { 1555 callback) {
1540 DCHECK(!callback.is_null()); 1556 DCHECK(!callback.is_null());
1541 RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame(); 1557 RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame();
1542 if (!focused_frame) 1558 if (!focused_frame)
1543 return; 1559 return;
1544 if (GetRenderWidgetHostViewAndroid()) { 1560 if (GetRenderWidgetHostViewAndroid()) {
1545 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback( 1561 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback(
1546 callback); 1562 callback);
1547 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( 1563 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest(
1548 focused_frame->GetRoutingID(), max_length)); 1564 focused_frame->GetRoutingID(), max_length));
1549 } 1565 }
1550 } 1566 }
1551 1567
1552 void ContentViewCoreImpl::DidDeferAfterResponseStarted( 1568 void ContentViewCoreImpl::DidDeferAfterResponseStarted(
1553 const scoped_refptr<net::HttpResponseHeaders>& headers, 1569 const TransitionLayerData& transition_data) {
1554 const GURL& url) {
1555 JNIEnv* env = AttachCurrentThread(); 1570 JNIEnv* env = AttachCurrentThread();
1556 ScopedJavaLocalRef<jobject> obj(java_ref_.get(env)); 1571 ScopedJavaLocalRef<jobject> obj(java_ref_.get(env));
1557 if (obj.is_null()) 1572 if (obj.is_null())
1558 return; 1573 return;
1559 1574
1560 std::vector<GURL> entering_stylesheets; 1575 std::vector<GURL> entering_stylesheets;
1561 std::string transition_color; 1576 std::string transition_color;
1562 if (headers) { 1577 if (transition_data.response_headers) {
1563 TransitionRequestManager::ParseTransitionStylesheetsFromHeaders( 1578 TransitionRequestManager::ParseTransitionStylesheetsFromHeaders(
1564 headers, entering_stylesheets, url); 1579 transition_data.response_headers, entering_stylesheets,
1580 transition_data.request_url);
1565 1581
1566 headers->EnumerateHeader( 1582 transition_data.response_headers->EnumerateHeader(
1567 NULL, "X-Transition-Entering-Color", &transition_color); 1583 NULL, "X-Transition-Entering-Color", &transition_color);
1568 } 1584 }
1569 1585
1586 ScopedJavaLocalRef<jstring> jstring_markup(ConvertUTF8ToJavaString(
1587 env, transition_data.markup));
1588
1589 ScopedJavaLocalRef<jstring> jstring_css_selector(ConvertUTF8ToJavaString(
1590 env, transition_data.css_selector));
1591
1570 ScopedJavaLocalRef<jstring> jstring_transition_color(ConvertUTF8ToJavaString( 1592 ScopedJavaLocalRef<jstring> jstring_transition_color(ConvertUTF8ToJavaString(
1571 env, transition_color)); 1593 env, transition_color));
1572 1594
1573 Java_ContentViewCore_didDeferAfterResponseStarted( 1595 Java_ContentViewCore_didDeferAfterResponseStarted(
1574 env, obj.obj(), jstring_transition_color.obj()); 1596 env, obj.obj(), jstring_markup.obj(), jstring_css_selector.obj(),
1597 jstring_transition_color.obj());
1575 1598
1576 std::vector<GURL>::const_iterator iter = entering_stylesheets.begin(); 1599 std::vector<GURL>::const_iterator iter = entering_stylesheets.begin();
1577 for (; iter != entering_stylesheets.end(); ++iter) { 1600 for (; iter != entering_stylesheets.end(); ++iter) {
1578 ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString( 1601 ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString(
1579 env, iter->spec())); 1602 env, iter->spec()));
1580 Java_ContentViewCore_addEnteringStylesheetToTransition( 1603 Java_ContentViewCore_addEnteringStylesheetToTransition(
1581 env, obj.obj(), jstring_url.obj()); 1604 env, obj.obj(), jstring_url.obj());
1582 } 1605 }
1583 } 1606 }
1584 1607
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 reinterpret_cast<ui::WindowAndroid*>(window_android), 1660 reinterpret_cast<ui::WindowAndroid*>(window_android),
1638 retained_objects_set); 1661 retained_objects_set);
1639 return reinterpret_cast<intptr_t>(view); 1662 return reinterpret_cast<intptr_t>(view);
1640 } 1663 }
1641 1664
1642 bool RegisterContentViewCore(JNIEnv* env) { 1665 bool RegisterContentViewCore(JNIEnv* env) {
1643 return RegisterNativesImpl(env); 1666 return RegisterNativesImpl(env);
1644 } 1667 }
1645 1668
1646 } // namespace content 1669 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698