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 18 matching lines...) Expand all Loading... |
29 #include "content/browser/renderer_host/input/motion_event_android.h" | 29 #include "content/browser/renderer_host/input/motion_event_android.h" |
30 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 30 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
31 #include "content/browser/renderer_host/input/web_input_event_util.h" | 31 #include "content/browser/renderer_host/input/web_input_event_util.h" |
32 #include "content/browser/renderer_host/java/java_bound_object.h" | 32 #include "content/browser/renderer_host/java/java_bound_object.h" |
33 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 33 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
34 #include "content/browser/renderer_host/render_view_host_impl.h" | 34 #include "content/browser/renderer_host/render_view_host_impl.h" |
35 #include "content/browser/renderer_host/render_widget_host_impl.h" | 35 #include "content/browser/renderer_host/render_widget_host_impl.h" |
36 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 36 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
37 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" | 37 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" |
38 #include "content/browser/ssl/ssl_host_state.h" | 38 #include "content/browser/ssl/ssl_host_state.h" |
| 39 #include "content/browser/transition_request_manager.h" |
39 #include "content/browser/web_contents/web_contents_view_android.h" | 40 #include "content/browser/web_contents/web_contents_view_android.h" |
40 #include "content/common/input/web_input_event_traits.h" | 41 #include "content/common/input/web_input_event_traits.h" |
41 #include "content/common/input_messages.h" | 42 #include "content/common/input_messages.h" |
42 #include "content/common/view_messages.h" | 43 #include "content/common/view_messages.h" |
43 #include "content/public/browser/browser_accessibility_state.h" | 44 #include "content/public/browser/browser_accessibility_state.h" |
44 #include "content/public/browser/browser_context.h" | 45 #include "content/public/browser/browser_context.h" |
45 #include "content/public/browser/favicon_status.h" | 46 #include "content/public/browser/favicon_status.h" |
46 #include "content/public/browser/render_frame_host.h" | 47 #include "content/public/browser/render_frame_host.h" |
47 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
48 #include "content/public/common/content_client.h" | 49 #include "content/public/common/content_client.h" |
(...skipping 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 static_cast<int>(x / dpi_scale()), | 1572 static_cast<int>(x / dpi_scale()), |
1572 static_cast<int>(y / dpi_scale()), | 1573 static_cast<int>(y / dpi_scale()), |
1573 static_cast<int>((width > 0 && width < dpi_scale()) ? | 1574 static_cast<int>((width > 0 && width < dpi_scale()) ? |
1574 1 : (int)(width / dpi_scale())), | 1575 1 : (int)(width / dpi_scale())), |
1575 static_cast<int>((height > 0 && height < dpi_scale()) ? | 1576 static_cast<int>((height > 0 && height < dpi_scale()) ? |
1576 1 : (int)(height / dpi_scale()))); | 1577 1 : (int)(height / dpi_scale()))); |
1577 GetWebContents()->Send(new ViewMsg_ExtractSmartClipData( | 1578 GetWebContents()->Send(new ViewMsg_ExtractSmartClipData( |
1578 GetWebContents()->GetRoutingID(), rect)); | 1579 GetWebContents()->GetRoutingID(), rect)); |
1579 } | 1580 } |
1580 | 1581 |
| 1582 void ContentViewCoreImpl::ResumeResponseDeferredAtStart(JNIEnv* env, |
| 1583 jobject obj) { |
| 1584 static_cast<WebContentsImpl*>(GetWebContents())-> |
| 1585 ResumeResponseDeferredAtStart(); |
| 1586 } |
| 1587 |
| 1588 void ContentViewCoreImpl::SetHasPendingNavigationTransitionForTesting( |
| 1589 JNIEnv* env, |
| 1590 jobject obj) { |
| 1591 RenderFrameHost* frame = static_cast<WebContentsImpl*>(GetWebContents())-> |
| 1592 GetMainFrame(); |
| 1593 TransitionRequestManager::GetInstance()->SetHasPendingTransitionRequest( |
| 1594 frame->GetProcess()->GetID(), frame->GetRoutingID(), true); |
| 1595 } |
| 1596 |
1581 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { | 1597 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { |
1582 return GetRenderProcessIdFromRenderViewHost( | 1598 return GetRenderProcessIdFromRenderViewHost( |
1583 web_contents_->GetRenderViewHost()); | 1599 web_contents_->GetRenderViewHost()); |
1584 } | 1600 } |
1585 | 1601 |
| 1602 void ContentViewCoreImpl::DidDeferAfterResponseStarted() { |
| 1603 JNIEnv* env = AttachCurrentThread(); |
| 1604 ScopedJavaLocalRef<jobject> obj(java_ref_.get(env)); |
| 1605 if (obj.is_null()) |
| 1606 return; |
| 1607 Java_ContentViewCore_didDeferAfterResponseStarted(env, obj.obj()); |
| 1608 } |
| 1609 |
| 1610 bool ContentViewCoreImpl::WillHandleDeferAfterResponseStarted() { |
| 1611 JNIEnv* env = AttachCurrentThread(); |
| 1612 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1613 if (obj.is_null()) |
| 1614 return false; |
| 1615 |
| 1616 return Java_ContentViewCore_willHandleDeferAfterResponseStarted(env, |
| 1617 obj.obj()); |
| 1618 } |
| 1619 |
1586 void ContentViewCoreImpl::OnSmartClipDataExtracted( | 1620 void ContentViewCoreImpl::OnSmartClipDataExtracted( |
1587 const base::string16& result) { | 1621 const base::string16& result) { |
1588 JNIEnv* env = AttachCurrentThread(); | 1622 JNIEnv* env = AttachCurrentThread(); |
1589 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1623 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
1590 if (obj.is_null()) | 1624 if (obj.is_null()) |
1591 return; | 1625 return; |
1592 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); | 1626 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); |
1593 Java_ContentViewCore_onSmartClipDataExtracted( | 1627 Java_ContentViewCore_onSmartClipDataExtracted( |
1594 env, obj.obj(), jresult.obj()); | 1628 env, obj.obj(), jresult.obj()); |
1595 } | 1629 } |
(...skipping 19 matching lines...) Expand all Loading... |
1615 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1649 reinterpret_cast<ui::WindowAndroid*>(window_android), |
1616 retained_objects_set); | 1650 retained_objects_set); |
1617 return reinterpret_cast<intptr_t>(view); | 1651 return reinterpret_cast<intptr_t>(view); |
1618 } | 1652 } |
1619 | 1653 |
1620 bool RegisterContentViewCore(JNIEnv* env) { | 1654 bool RegisterContentViewCore(JNIEnv* env) { |
1621 return RegisterNativesImpl(env); | 1655 return RegisterNativesImpl(env); |
1622 } | 1656 } |
1623 | 1657 |
1624 } // namespace content | 1658 } // namespace content |
OLD | NEW |