| 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..9f1b3c2203fa4fd9bc4f911a52423423beafd42d 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->GetRoutingID(),
|
| + request_id,
|
| + blink::WebLockOrientationCallback::ErrorTypeNotAvailable));
|
| return;
|
| }
|
|
|
| // TODO(mlamouri): pass real values.
|
| Send(new ScreenOrientationMsg_LockSuccess(
|
| - request_id,
|
| - 0,
|
| - blink::WebScreenOrientationPortraitPrimary));
|
| + 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;
|
|
|
|
|