OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" | 5 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" |
6 | 6 |
7 #include "content/browser/screen_orientation/screen_orientation_provider.h" | 7 #include "content/browser/screen_orientation/screen_orientation_provider.h" |
8 #include "content/common/screen_orientation_messages.h" | 8 #include "content/common/screen_orientation_messages.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 ScreenOrientationDispatcherHost::ScreenOrientationDispatcherHost() | 12 ScreenOrientationDispatcherHost::ScreenOrientationDispatcherHost() |
13 : BrowserMessageFilter(ScreenOrientationMsgStart) { | 13 : BrowserMessageFilter(ScreenOrientationMsgStart) { |
14 if (!provider_.get()) | 14 if (!provider_.get()) |
15 provider_.reset(CreateProvider()); | 15 provider_.reset(CreateProvider()); |
16 } | 16 } |
17 | 17 |
18 ScreenOrientationDispatcherHost::~ScreenOrientationDispatcherHost() { | 18 ScreenOrientationDispatcherHost::~ScreenOrientationDispatcherHost() { |
19 } | 19 } |
20 | 20 |
21 bool ScreenOrientationDispatcherHost::OnMessageReceived( | 21 bool ScreenOrientationDispatcherHost::OnMessageReceived( |
22 const IPC::Message& message, bool* message_was_ok) { | 22 const IPC::Message& message) { |
23 bool handled = true; | 23 bool handled = true; |
24 | 24 |
25 IPC_BEGIN_MESSAGE_MAP_EX(ScreenOrientationDispatcherHost, | 25 IPC_BEGIN_MESSAGE_MAP(ScreenOrientationDispatcherHost, message) |
26 message, | |
27 *message_was_ok) | |
28 IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_Lock, OnLockRequest) | 26 IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_Lock, OnLockRequest) |
29 IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_Unlock, OnUnlockRequest) | 27 IPC_MESSAGE_HANDLER(ScreenOrientationHostMsg_Unlock, OnUnlockRequest) |
30 IPC_MESSAGE_UNHANDLED(handled = false) | 28 IPC_MESSAGE_UNHANDLED(handled = false) |
31 IPC_END_MESSAGE_MAP_EX() | 29 IPC_END_MESSAGE_MAP() |
32 | 30 |
33 return handled; | 31 return handled; |
34 } | 32 } |
35 | 33 |
36 void ScreenOrientationDispatcherHost::OnOrientationChange( | 34 void ScreenOrientationDispatcherHost::OnOrientationChange( |
37 blink::WebScreenOrientationType orientation) { | 35 blink::WebScreenOrientationType orientation) { |
38 Send(new ScreenOrientationMsg_OrientationChange(orientation)); | 36 Send(new ScreenOrientationMsg_OrientationChange(orientation)); |
39 } | 37 } |
40 | 38 |
41 void ScreenOrientationDispatcherHost::SetProviderForTests( | 39 void ScreenOrientationDispatcherHost::SetProviderForTests( |
(...skipping 17 matching lines...) Expand all Loading... |
59 } | 57 } |
60 | 58 |
61 #if !defined(OS_ANDROID) | 59 #if !defined(OS_ANDROID) |
62 // static | 60 // static |
63 ScreenOrientationProvider* ScreenOrientationDispatcherHost::CreateProvider() { | 61 ScreenOrientationProvider* ScreenOrientationDispatcherHost::CreateProvider() { |
64 return NULL; | 62 return NULL; |
65 } | 63 } |
66 #endif | 64 #endif |
67 | 65 |
68 } // namespace content | 66 } // namespace content |
OLD | NEW |