| 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 12 matching lines...) Expand all Loading... |
| 23 #include "content/browser/frame_host/navigation_controller_impl.h" | 23 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 24 #include "content/browser/frame_host/navigation_entry_impl.h" | 24 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 25 #include "content/browser/media/android/browser_media_player_manager.h" | 25 #include "content/browser/media/android/browser_media_player_manager.h" |
| 26 #include "content/browser/renderer_host/compositor_impl_android.h" | 26 #include "content/browser/renderer_host/compositor_impl_android.h" |
| 27 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" | 27 #include "content/browser/renderer_host/input/web_input_event_builders_android.h
" |
| 28 #include "content/browser/renderer_host/java/java_bound_object.h" | 28 #include "content/browser/renderer_host/java/java_bound_object.h" |
| 29 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" | 29 #include "content/browser/renderer_host/java/java_bridge_dispatcher_host_manager
.h" |
| 30 #include "content/browser/renderer_host/render_view_host_impl.h" | 30 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 31 #include "content/browser/renderer_host/render_widget_host_impl.h" | 31 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 32 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 32 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| 33 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" |
| 33 #include "content/browser/ssl/ssl_host_state.h" | 34 #include "content/browser/ssl/ssl_host_state.h" |
| 34 #include "content/browser/web_contents/web_contents_view_android.h" | 35 #include "content/browser/web_contents/web_contents_view_android.h" |
| 35 #include "content/common/input/web_input_event_traits.h" | 36 #include "content/common/input/web_input_event_traits.h" |
| 36 #include "content/common/input_messages.h" | 37 #include "content/common/input_messages.h" |
| 37 #include "content/common/view_messages.h" | 38 #include "content/common/view_messages.h" |
| 38 #include "content/public/browser/android/external_video_surface_container.h" | 39 #include "content/public/browser/android/external_video_surface_container.h" |
| 39 #include "content/public/browser/browser_accessibility_state.h" | 40 #include "content/public/browser/browser_accessibility_state.h" |
| 40 #include "content/public/browser/browser_context.h" | 41 #include "content/public/browser/browser_context.h" |
| 41 #include "content/public/browser/favicon_status.h" | 42 #include "content/public/browser/favicon_status.h" |
| 42 #include "content/public/browser/notification_details.h" | 43 #include "content/public/browser/notification_details.h" |
| (...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 } | 1777 } |
| 1777 | 1778 |
| 1778 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { | 1779 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { |
| 1779 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); | 1780 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); |
| 1780 if (rwhv) | 1781 if (rwhv) |
| 1781 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); | 1782 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); |
| 1782 | 1783 |
| 1783 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1784 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
| 1784 web_contents_->GetRenderViewHost()); | 1785 web_contents_->GetRenderViewHost()); |
| 1785 rvhi->SendOrientationChangeEvent(device_orientation_); | 1786 rvhi->SendOrientationChangeEvent(device_orientation_); |
| 1787 |
| 1788 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change |
| 1789 // in the future. It might leave ContentViewCoreImpl or simply replace the |
| 1790 // SendOrientationChangeEvent call above. |
| 1791 blink::WebScreenOrientation orientation = |
| 1792 blink::WebScreenOrientationPortraitPrimary; |
| 1793 |
| 1794 switch (device_orientation_) { |
| 1795 case 0: |
| 1796 orientation = blink::WebScreenOrientationPortraitPrimary; |
| 1797 break; |
| 1798 case 90: |
| 1799 orientation = blink::WebScreenOrientationLandscapePrimary; |
| 1800 break; |
| 1801 case -90: |
| 1802 orientation = blink::WebScreenOrientationLandscapeSecondary; |
| 1803 break; |
| 1804 case 180: |
| 1805 orientation = blink::WebScreenOrientationPortraitSecondary; |
| 1806 break; |
| 1807 default: |
| 1808 NOTREACHED(); |
| 1809 } |
| 1810 |
| 1811 ScreenOrientationDispatcherHost* sodh = |
| 1812 static_cast<RenderProcessHostImpl*>(web_contents_-> |
| 1813 GetRenderProcessHost())->screen_orientation_dispatcher_host(); |
| 1814 |
| 1815 if (sodh) |
| 1816 sodh->OnOrientationChange(orientation); |
| 1786 } | 1817 } |
| 1787 | 1818 |
| 1788 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, | 1819 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, |
| 1789 jobject obj, | 1820 jobject obj, |
| 1790 jint x, | 1821 jint x, |
| 1791 jint y, | 1822 jint y, |
| 1792 jint width, | 1823 jint width, |
| 1793 jint height) { | 1824 jint height) { |
| 1794 gfx::Rect rect( | 1825 gfx::Rect rect( |
| 1795 static_cast<int>(x / GetDpiScale()), | 1826 static_cast<int>(x / GetDpiScale()), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1832 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1863 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1833 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1864 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1834 return reinterpret_cast<intptr_t>(view); | 1865 return reinterpret_cast<intptr_t>(view); |
| 1835 } | 1866 } |
| 1836 | 1867 |
| 1837 bool RegisterContentViewCore(JNIEnv* env) { | 1868 bool RegisterContentViewCore(JNIEnv* env) { |
| 1838 return RegisterNativesImpl(env); | 1869 return RegisterNativesImpl(env); |
| 1839 } | 1870 } |
| 1840 | 1871 |
| 1841 } // namespace content | 1872 } // namespace content |
| OLD | NEW |