Chromium Code Reviews| 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 19 matching lines...) Expand all Loading... | |
| 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/web_contents/web_contents_view_android.h" | 39 #include "content/browser/web_contents/web_contents_view_android.h" |
| 40 #include "content/common/frame_messages.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" |
| 49 #include "content/public/common/content_switches.h" | 50 #include "content/public/common/content_switches.h" |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1527 // If it was actually enabled globally, enable it for this RenderWidget now. | 1528 // If it was actually enabled globally, enable it for this RenderWidget now. |
| 1528 if (accessibility_state->IsAccessibleBrowser() && host_impl) | 1529 if (accessibility_state->IsAccessibleBrowser() && host_impl) |
| 1529 host_impl->AddAccessibilityMode(AccessibilityModeComplete); | 1530 host_impl->AddAccessibilityMode(AccessibilityModeComplete); |
| 1530 } else { | 1531 } else { |
| 1531 accessibility_state->ResetAccessibilityMode(); | 1532 accessibility_state->ResetAccessibilityMode(); |
| 1532 if (host_impl) | 1533 if (host_impl) |
| 1533 host_impl->ResetAccessibilityMode(); | 1534 host_impl->ResetAccessibilityMode(); |
| 1534 } | 1535 } |
| 1535 } | 1536 } |
| 1536 | 1537 |
| 1538 void ContentViewCoreImpl::OnTextSurroundingSelectionResponse( | |
| 1539 const base::string16& content, | |
| 1540 int start_offset, | |
| 1541 int end_offset) { | |
| 1542 JNIEnv* env = AttachCurrentThread(); | |
| 1543 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | |
| 1544 if (obj.is_null()) | |
| 1545 return; | |
| 1546 | |
| 1547 ScopedJavaLocalRef<jstring> jcontent = ConvertUTF16ToJavaString(env, content); | |
| 1548 Java_ContentViewCore_onTextSurroundingSelectionResponse( | |
|
jdduke (slow)
2014/06/06 01:28:31
I believe Donn is exploring ways to route the stri
| |
| 1549 env, obj.obj(), jcontent.obj(), start_offset, end_offset); | |
| 1550 } | |
| 1551 | |
| 1537 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1552 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
| 1538 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1553 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1539 if (rwhv) | 1554 if (rwhv) |
| 1540 rwhv->UpdateScreenInfo(GetViewAndroid()); | 1555 rwhv->UpdateScreenInfo(GetViewAndroid()); |
| 1541 | 1556 |
| 1542 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change | 1557 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change |
| 1543 // in the future. The OnResize IPC message sent from UpdateScreenInfo() will | 1558 // in the future. The OnResize IPC message sent from UpdateScreenInfo() will |
| 1544 // propagate the information. | 1559 // propagate the information. |
| 1545 blink::WebScreenOrientationType orientation = | 1560 blink::WebScreenOrientationType orientation = |
| 1546 blink::WebScreenOrientationPortraitPrimary; | 1561 blink::WebScreenOrientationPortraitPrimary; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1593 return GetRenderProcessIdFromRenderViewHost( | 1608 return GetRenderProcessIdFromRenderViewHost( |
| 1594 web_contents_->GetRenderViewHost()); | 1609 web_contents_->GetRenderViewHost()); |
| 1595 } | 1610 } |
| 1596 | 1611 |
| 1597 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj, | 1612 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj, |
| 1598 jboolean opaque) { | 1613 jboolean opaque) { |
| 1599 if (GetRenderWidgetHostViewAndroid()) | 1614 if (GetRenderWidgetHostViewAndroid()) |
| 1600 GetRenderWidgetHostViewAndroid()->SetBackgroundOpaque(opaque); | 1615 GetRenderWidgetHostViewAndroid()->SetBackgroundOpaque(opaque); |
| 1601 } | 1616 } |
| 1602 | 1617 |
| 1618 void ContentViewCoreImpl::TextSurroundingSelectionRequest( | |
| 1619 JNIEnv*, jobject, jint max_length) { | |
| 1620 RenderFrameHost* focused_frame = web_contents_->GetFocusedFrame(); | |
| 1621 | |
| 1622 focused_frame->Send(new FrameMsg_TextSurroundingSelectionRequest( | |
| 1623 focused_frame->GetRoutingID(), max_length)); | |
| 1624 } | |
| 1625 | |
| 1603 void ContentViewCoreImpl::OnSmartClipDataExtracted( | 1626 void ContentViewCoreImpl::OnSmartClipDataExtracted( |
| 1604 const base::string16& result) { | 1627 const base::string16& result) { |
| 1605 JNIEnv* env = AttachCurrentThread(); | 1628 JNIEnv* env = AttachCurrentThread(); |
| 1606 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 1629 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 1607 if (obj.is_null()) | 1630 if (obj.is_null()) |
| 1608 return; | 1631 return; |
| 1609 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); | 1632 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); |
| 1610 Java_ContentViewCore_onSmartClipDataExtracted( | 1633 Java_ContentViewCore_onSmartClipDataExtracted( |
| 1611 env, obj.obj(), jresult.obj()); | 1634 env, obj.obj(), jresult.obj()); |
| 1612 } | 1635 } |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 1632 reinterpret_cast<ui::WindowAndroid*>(window_android), | 1655 reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 1633 retained_objects_set); | 1656 retained_objects_set); |
| 1634 return reinterpret_cast<intptr_t>(view); | 1657 return reinterpret_cast<intptr_t>(view); |
| 1635 } | 1658 } |
| 1636 | 1659 |
| 1637 bool RegisterContentViewCore(JNIEnv* env) { | 1660 bool RegisterContentViewCore(JNIEnv* env) { |
| 1638 return RegisterNativesImpl(env); | 1661 return RegisterNativesImpl(env); |
| 1639 } | 1662 } |
| 1640 | 1663 |
| 1641 } // namespace content | 1664 } // namespace content |
| OLD | NEW |