1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_
6 #define CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_
8 #include "third_party/WebKit/public/web/WebDeviceOrientationClient.h"
9 #include "third_party/WebKit/public/web/WebDeviceOrientation.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "content/public/renderer/render_view_observer.h"
14 struct DeviceOrientationMsg_Updated_Params
;
19 class DeviceOrientationDispatcher
: public RenderViewObserver
,
20 public WebKit::WebDeviceOrientationClient
{
22 explicit DeviceOrientationDispatcher(RenderViewImpl
* render_view
);
23 virtual ~DeviceOrientationDispatcher();
26 // RenderView::Observer implementation.
27 virtual bool OnMessageReceived(const IPC::Message
& message
) OVERRIDE
;
29 // From WebKit::WebDeviceOrientationClient.
30 virtual void setController(
31 WebKit::WebDeviceOrientationController
* controller
);
32 virtual void startUpdating();
33 virtual void stopUpdating();
34 virtual WebKit::WebDeviceOrientation
lastOrientation() const;
36 void OnDeviceOrientationUpdated(
37 const DeviceOrientationMsg_Updated_Params
& p
);
39 scoped_ptr
<WebKit::WebDeviceOrientationController
> controller_
;
40 WebKit::WebDeviceOrientation last_orientation_
;
44 } // namespace content
46 #endif // CONTENT_RENDERER_DEVICE_ORIENTATION_DISPATCHER_H_