Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / content / renderer / screen_orientation / screen_orientation_dispatcher.cc
blob3416ec50a01a8cd87f06f26bb4c2f37ee2e53e48
1 // Copyright 2014 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 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h"
7 #include "content/common/screen_orientation_messages.h"
8 #include "content/public/renderer/render_thread.h"
9 #include "third_party/WebKit/public/platform/WebScreenOrientationListener.h"
11 namespace content {
13 ScreenOrientationDispatcher::ScreenOrientationDispatcher(
14 RenderThread* thread)
15 : listener_(NULL) {
16 thread->AddObserver(this);
19 bool ScreenOrientationDispatcher::OnControlMessageReceived(
20 const IPC::Message& message) {
21 bool handled = true;
23 IPC_BEGIN_MESSAGE_MAP(ScreenOrientationDispatcher, message)
24 IPC_MESSAGE_HANDLER(ScreenOrientationMsg_OrientationChange,
25 OnOrientationChange)
26 IPC_MESSAGE_UNHANDLED(handled = false)
27 IPC_END_MESSAGE_MAP()
29 return handled;
32 void ScreenOrientationDispatcher::OnOrientationChange(
33 blink::WebScreenOrientationType orientation) {
34 if (!listener_)
35 return;
37 listener_->didChangeScreenOrientation(orientation);
40 void ScreenOrientationDispatcher::setListener(
41 blink::WebScreenOrientationListener* listener) {
42 listener_ = listener;
45 } // namespace content