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

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

Issue 327573002: Properly route screen orientation IPC messages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screen_lock_view
Patch Set: review comments Created 6 years, 6 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 3bb494d93f900109ee2ed43fb84bcbf79c943951..67174d028ea294f88a2579eb5779ec036bf51397 100644
--- a/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
+++ b/content/browser/screen_orientation/screen_orientation_dispatcher_host.cc
@@ -6,11 +6,14 @@
#include "content/browser/screen_orientation/screen_orientation_provider.h"
#include "content/common/screen_orientation_messages.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/browser/web_contents.h"
namespace content {
-ScreenOrientationDispatcherHost::ScreenOrientationDispatcherHost()
- : BrowserMessageFilter(ScreenOrientationMsgStart) {
+ScreenOrientationDispatcherHost::ScreenOrientationDispatcherHost(
+ WebContents* web_contents)
+ : WebContentsObserver(web_contents) {
if (!provider_.get())
provider_.reset(CreateProvider());
}
@@ -19,10 +22,12 @@ ScreenOrientationDispatcherHost::~ScreenOrientationDispatcherHost() {
}
bool ScreenOrientationDispatcherHost::OnMessageReceived(
- const IPC::Message& message) {
+ const IPC::Message& message,
+ RenderFrameHost* render_frame_host) {
bool handled = true;
- IPC_BEGIN_MESSAGE_MAP(ScreenOrientationDispatcherHost, message)
+ IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(ScreenOrientationDispatcherHost, message,
+ render_frame_host)
IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_LockRequest, OnLockRequest)
IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_Unlock, OnUnlockRequest)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -42,24 +47,28 @@ void ScreenOrientationDispatcherHost::SetProviderForTests(
}
void ScreenOrientationDispatcherHost::OnLockRequest(
+ RenderFrameHost* render_frame_host,
blink::WebScreenOrientationLockType orientation,
int request_id) {
if (!provider_) {
- Send(new ScreenOrientationMsg_LockError(
- request_id,
- blink::WebLockOrientationCallback::ErrorTypeNotAvailable));
+ render_frame_host->Send(new ScreenOrientationMsg_LockError(
+ render_frame_host->GetRoutingID(),
+ request_id,
+ blink::WebLockOrientationCallback::ErrorTypeNotAvailable));
return;
}
// TODO(mlamouri): pass real values.
- Send(new ScreenOrientationMsg_LockSuccess(
- request_id,
- 0,
- blink::WebScreenOrientationPortraitPrimary));
+ render_frame_host->Send(new ScreenOrientationMsg_LockSuccess(
+ render_frame_host->GetRoutingID(),
+ request_id,
+ 0,
+ blink::WebScreenOrientationPortraitPrimary));
provider_->LockOrientation(orientation);
}
-void ScreenOrientationDispatcherHost::OnUnlockRequest() {
+void ScreenOrientationDispatcherHost::OnUnlockRequest(
+ RenderFrameHost* render_frame_host) {
if (!provider_.get())
return;

Powered by Google App Engine
This is Rietveld 408576698