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

Unified Diff: content/browser/screen_orientation/screen_orientation_dispatcher_host.cc

Issue 177793003: Chromium plumbing for Screen Orientation API lock/unlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chromium_plumbing_screen_orientation
Patch Set: with tests 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
Index: content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
diff --git a/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc b/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
index c868beba44f03262c4b3b94bd9a627009aa1f8d2..5e5e35babbdec9cd1ee70b4d6ef747a03e5010eb 100644
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
+++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
@@ -4,17 +4,32 @@
#include "content/browser/screen_orientation/screen_orientation_dispatcher_host.h"
+#include "content/browser/screen_orientation/screen_orientation_provider.h"
#include "content/common/screen_orientation_messages.h"
namespace content {
ScreenOrientationDispatcherHost::ScreenOrientationDispatcherHost() {
+ if (!provider_.get())
+ provider_.reset(CreateProvider());
+}
+
+ScreenOrientationDispatcherHost::~ScreenOrientationDispatcherHost() {
}
bool ScreenOrientationDispatcherHost::OnMessageReceived(
const IPC::Message& message, bool* message_was_ok) {
- // TODO(mlamouri): we will handle lock and unlock requests here.
- return false;
+ bool handled = true;
+
+ IPC_BEGIN_MESSAGE_MAP_EX(ScreenOrientationDispatcherHost,
+ message,
+ *message_was_ok)
+ IPC_MESSAGE_HANDLER(ScreenOrientationMsg_Lock, OnLockRequest)
+ IPC_MESSAGE_HANDLER(ScreenOrientationMsg_Unlock, OnUnlockRequest)
Cris Neckar 2014/02/24 21:02:28 Currently sending these messages will result in a
mlamouri (slow - plz ping) 2014/02/24 21:47:50 I'm not sure I understand wyh that would crash. Be
Cris Neckar 2014/02/24 22:00:04 oh my mistake I was reading too quickly. Saw the c
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP_EX()
+
+ return handled;
}
void ScreenOrientationDispatcherHost::OnOrientationChange(
@@ -22,4 +37,29 @@ void ScreenOrientationDispatcherHost::OnOrientationChange(
Send(new ScreenOrientationMsg_OrientationChange(orientation));
}
+void ScreenOrientationDispatcherHost::SetProviderForTests(
+ ScreenOrientationProvider* provider) {
+ provider_.reset(provider);
+}
+
+void ScreenOrientationDispatcherHost::OnLockRequest(
+ blink::WebScreenOrientations orientations) {
+ if (!provider_.get())
+ return;
+
+ provider_->LockOrientation(orientations);
Cris Neckar 2014/02/24 21:02:28 remove this until you actually implement it. You
+}
+
+void ScreenOrientationDispatcherHost::OnUnlockRequest() {
+ if (!provider_.get())
+ return;
+
+ provider_->UnlockOrientation();
Cris Neckar 2014/02/24 21:02:28 ditto
+}
+
+// static
+ScreenOrientationProvider* ScreenOrientationDispatcherHost::CreateProvider() {
+ return NULL;
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698