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

Unified 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, 10 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/android/content_view_core_impl.cc
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 357d2a9b585851b3f9fff9c2c1a894d59d3e1824..1e7221d72ad97ac1b26666ee132c2f42dad22e81 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -30,6 +30,7 @@
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_android.h"
+#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
#include "content/browser/ssl/ssl_host_state.h"
#include "content/browser/web_contents/web_contents_view_android.h"
#include "content/common/input/web_input_event_traits.h"
@@ -1784,6 +1785,38 @@ void ContentViewCoreImpl::SendOrientationChangeEventInternal() {
RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
web_contents_->GetRenderViewHost());
rvhi->SendOrientationChangeEvent(device_orientation_);
+
+ // TODO(mlamouri): temporary plumbing for Screen Orientation, this will change
+ // in the future. It might leave ContentViewCoreImpl or simply replace the
+ // SendOrientationChangeEvent call above.
+ blink::WebScreenOrientation orientation =
+ blink::WebScreenOrientationPortraitPrimary;
+
+ switch (device_orientation_) {
+ case 0:
+ orientation = blink::WebScreenOrientationPortraitPrimary;
+ break;
+ case 90:
+ orientation = blink::WebScreenOrientationLandscapePrimary;
+ break;
+ case -90:
+ orientation = blink::WebScreenOrientationLandscapeSecondary;
+ break;
+ case 180:
+ orientation = blink::WebScreenOrientationPortraitSecondary;
+ break;
+ default:
+ NOTREACHED();
+ }
+
+ ScreenOrientationDispatcherHost* sodh =
+ static_cast<RenderProcessHostImpl*>(web_contents_->
+ GetRenderProcessHost())->screen_orientation_dispatcher_host();
+
+ // sodh can be null if the RenderProcessHost is in the process of being
+ // destroyed or not yet initialized.
+ if (sodh)
+ sodh->OnOrientationChange(orientation);
}
void ContentViewCoreImpl::ExtractSmartClipData(JNIEnv* env,
« 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