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

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

Issue 176963016: Chromium plumbing for Screen Orientation API orientationchange events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 9 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
« no previous file with comments | « content/browser/DEPS ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12 matching lines...) Expand all
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 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 } 1778 }
1778 1779
1779 void ContentViewCoreImpl::SendOrientationChangeEventInternal() { 1780 void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
1780 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid(); 1781 RenderWidgetHostViewAndroid* rwhv = GetRenderWidgetHostViewAndroid();
1781 if (rwhv) 1782 if (rwhv)
1782 rwhv->UpdateScreenInfo(rwhv->GetNativeView()); 1783 rwhv->UpdateScreenInfo(rwhv->GetNativeView());
1783 1784
1784 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( 1785 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
1785 web_contents_->GetRenderViewHost()); 1786 web_contents_->GetRenderViewHost());
1786 rvhi->SendOrientationChangeEvent(device_orientation_); 1787 rvhi->SendOrientationChangeEvent(device_orientation_);
1788
1789 // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change
1790 // in the future. It might leave ContentViewCoreImpl or simply replace the
1791 // SendOrientationChangeEvent call above.
1792 blink::WebScreenOrientation orientation =
1793 blink::WebScreenOrientationPortraitPrimary;
1794
1795 switch (device_orientation_) {
1796 case 0:
1797 orientation = blink::WebScreenOrientationPortraitPrimary;
1798 break;
1799 case 90:
1800 orientation = blink::WebScreenOrientationLandscapePrimary;
1801 break;
1802 case -90:
1803 orientation = blink::WebScreenOrientationLandscapeSecondary;
1804 break;
1805 case 180:
1806 orientation = blink::WebScreenOrientationPortraitSecondary;
1807 break;
1808 default:
1809 NOTREACHED();
1810 }
1811
1812 ScreenOrientationDispatcherHost* sodh =
1813 static_cast<RenderProcessHostImpl*>(web_contents_->
1814 GetRenderProcessHost())->screen_orientation_dispatcher_host();
1815
1816 // sodh can be null if the RenderProcessHost is in the process of being
1817 // destroyed or not yet initialized.
1818 if (sodh)
1819 sodh->OnOrientationChange(orientation);
1787 } 1820 }
1788 1821
1789 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env, 1822 void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env,
1790 jobject obj, 1823 jobject obj,
1791 jint x, 1824 jint x,
1792 jint y, 1825 jint y,
1793 jint width, 1826 jint width,
1794 jint height) { 1827 jint height) {
1795 gfx::Rect rect( 1828 gfx::Rect rect(
1796 static_cast<int>(x / GetDpiScale()), 1829 static_cast<int>(x / GetDpiScale()),
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1833 reinterpret_cast<ui::ViewAndroid*>(view_android), 1866 reinterpret_cast<ui::ViewAndroid*>(view_android),
1834 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1867 reinterpret_cast<ui::WindowAndroid*>(window_android));
1835 return reinterpret_cast<intptr_t>(view); 1868 return reinterpret_cast<intptr_t>(view);
1836 } 1869 }
1837 1870
1838 bool RegisterContentViewCore(JNIEnv* env) { 1871 bool RegisterContentViewCore(JNIEnv* env) {
1839 return RegisterNativesImpl(env); 1872 return RegisterNativesImpl(env);
1840 } 1873 }
1841 1874
1842 } // namespace content 1875 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/DEPS ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698