| OLD | NEW |
| 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 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 if (!focused_frame) | 1545 if (!focused_frame) |
| 1546 return; | 1546 return; |
| 1547 if (GetRenderWidgetHostViewAndroid()) { | 1547 if (GetRenderWidgetHostViewAndroid()) { |
| 1548 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback( | 1548 GetRenderWidgetHostViewAndroid()->SetTextSurroundingSelectionCallback( |
| 1549 callback); | 1549 callback); |
| 1550 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( | 1550 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( |
| 1551 focused_frame->GetRoutingID(), max_length)); | 1551 focused_frame->GetRoutingID(), max_length)); |
| 1552 } | 1552 } |
| 1553 } | 1553 } |
| 1554 | 1554 |
| 1555 void ContentViewCoreImpl::DidDeferAfterResponseStarted() { | 1555 void ContentViewCoreImpl::DidDeferAfterResponseStarted( |
| 1556 const scoped_refptr<net::HttpResponseHeaders>& headers, |
| 1557 const GURL& url) { |
| 1556 JNIEnv* env = AttachCurrentThread(); | 1558 JNIEnv* env = AttachCurrentThread(); |
| 1557 ScopedJavaLocalRef<jobject> obj(java_ref_.get(env)); | 1559 ScopedJavaLocalRef<jobject> obj(java_ref_.get(env)); |
| 1558 if (obj.is_null()) | 1560 if (obj.is_null()) |
| 1559 return; | 1561 return; |
| 1562 |
| 1563 std::vector<GURL> entering_stylesheets; |
| 1564 if (headers) |
| 1565 TransitionRequestManager::ParseTransitionStylesheetsFromHeaders( |
| 1566 headers, entering_stylesheets, url); |
| 1567 |
| 1560 Java_ContentViewCore_didDeferAfterResponseStarted(env, obj.obj()); | 1568 Java_ContentViewCore_didDeferAfterResponseStarted(env, obj.obj()); |
| 1569 |
| 1570 std::vector<GURL>::const_iterator iter = entering_stylesheets.begin(); |
| 1571 for (; iter != entering_stylesheets.end(); ++iter) { |
| 1572 ScopedJavaLocalRef<jstring> jstring_url(ConvertUTF8ToJavaString( |
| 1573 env, iter->spec())); |
| 1574 Java_ContentViewCore_addEnteringStylesheetToTransition( |
| 1575 env, obj.obj(), jstring_url.obj()); |
| 1576 } |
| 1561 } | 1577 } |
| 1562 | 1578 |
| 1563 bool ContentViewCoreImpl::WillHandleDeferAfterResponseStarted() { | 1579 bool ContentViewCoreImpl::WillHandleDeferAfterResponseStarted() { |
| 1564 JNIEnv* env = AttachCurrentThread(); | 1580 JNIEnv* env = AttachCurrentThread(); |
| 1565 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1581 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1566 if (obj.is_null()) | 1582 if (obj.is_null()) |
| 1567 return false; | 1583 return false; |
| 1568 | 1584 |
| 1569 return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env, | 1585 return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env, |
| 1570 obj.obj()); | 1586 obj.obj()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1606 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1622 reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 1607 retained_objects_set); | 1623 retained_objects_set); |
| 1608 return reinterpret_cast<intptr_t>(view); | 1624 return reinterpret_cast<intptr_t>(view); |
| 1609 } | 1625 } |
| 1610 | 1626 |
| 1611 bool RegisterContentViewCore(JNIEnv* env) { | 1627 bool RegisterContentViewCore(JNIEnv* env) { |
| 1612 return RegisterNativesImpl(env); | 1628 return RegisterNativesImpl(env); |
| 1613 } | 1629 } |
| 1614 | 1630 |
| 1615 } // namespace content | 1631 } // namespace content |
| OLD | NEW |