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

Side by Side Diff: content/renderer/screen_orientation/screen_orientation_dispatcher.cc

Issue 176963016: Chromium plumbing for Screen Orientation API orientationchange events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h"
6
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"
10
11 namespace content {
12
13 ScreenOrientationDispatcher::ScreenOrientationDispatcher(
14 RenderThread* thread)
15 : listener_(NULL) {
16 thread->AddObserver(this);
17 }
18
19 bool ScreenOrientationDispatcher::OnControlMessageReceived(
20 const IPC::Message& message) {
21 bool handled = true;
22
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()
28
29 return handled;
30 }
31
32 void ScreenOrientationDispatcher::OnOrientationChange(
33 blink::WebScreenOrientation orientation) {
34 if (!listener_)
35 return;
36
37 listener_->didChangeScreenOrientation(orientation);
38 }
39
40 void ScreenOrientationDispatcher::setListener(
41 blink::WebScreenOrientationListener* listener) {
42 listener_ = listener;
43 }
44
45 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698