| 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/renderer/screen_orientation/screen_orientation_dispatcher.h" | 5 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" |
| 6 | 6 |
| 7 #include "content/common/screen_orientation_messages.h" | 7 #include "content/common/screen_orientation_messages.h" |
| 8 | 8 |
| 9 namespace content { | 9 namespace content { |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 IPC_MESSAGE_HANDLER(ScreenOrientationMsg_LockSuccess, | 24 IPC_MESSAGE_HANDLER(ScreenOrientationMsg_LockSuccess, |
| 25 OnLockSuccess) | 25 OnLockSuccess) |
| 26 IPC_MESSAGE_HANDLER(ScreenOrientationMsg_LockError, | 26 IPC_MESSAGE_HANDLER(ScreenOrientationMsg_LockError, |
| 27 OnLockError) | 27 OnLockError) |
| 28 IPC_MESSAGE_UNHANDLED(handled = false) | 28 IPC_MESSAGE_UNHANDLED(handled = false) |
| 29 IPC_END_MESSAGE_MAP() | 29 IPC_END_MESSAGE_MAP() |
| 30 | 30 |
| 31 return handled; | 31 return handled; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void ScreenOrientationDispatcher::OnLockSuccess( | 34 void ScreenOrientationDispatcher::OnLockSuccess(int request_id) { |
| 35 int request_id, | |
| 36 unsigned angle, | |
| 37 blink::WebScreenOrientationType orientation) { | |
| 38 blink::WebLockOrientationCallback* callback = | 35 blink::WebLockOrientationCallback* callback = |
| 39 pending_callbacks_.Lookup(request_id); | 36 pending_callbacks_.Lookup(request_id); |
| 40 if (!callback) | 37 if (!callback) |
| 41 return; | 38 return; |
| 42 callback->onSuccess(angle, orientation); | 39 callback->onSuccess(); |
| 43 pending_callbacks_.Remove(request_id); | 40 pending_callbacks_.Remove(request_id); |
| 44 } | 41 } |
| 45 | 42 |
| 46 void ScreenOrientationDispatcher::OnLockError( | 43 void ScreenOrientationDispatcher::OnLockError( |
| 47 int request_id, blink::WebLockOrientationError error) { | 44 int request_id, blink::WebLockOrientationError error) { |
| 48 blink::WebLockOrientationCallback* callback = | 45 blink::WebLockOrientationCallback* callback = |
| 49 pending_callbacks_.Lookup(request_id); | 46 pending_callbacks_.Lookup(request_id); |
| 50 if (!callback) | 47 if (!callback) |
| 51 return; | 48 return; |
| 52 callback->onError(error); | 49 callback->onError(error); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 70 Send(new ScreenOrientationHostMsg_LockRequest( | 67 Send(new ScreenOrientationHostMsg_LockRequest( |
| 71 routing_id(), orientation, request_id)); | 68 routing_id(), orientation, request_id)); |
| 72 } | 69 } |
| 73 | 70 |
| 74 void ScreenOrientationDispatcher::unlockOrientation() { | 71 void ScreenOrientationDispatcher::unlockOrientation() { |
| 75 CancelPendingLocks(); | 72 CancelPendingLocks(); |
| 76 Send(new ScreenOrientationHostMsg_Unlock(routing_id())); | 73 Send(new ScreenOrientationHostMsg_Unlock(routing_id())); |
| 77 } | 74 } |
| 78 | 75 |
| 79 } // namespace content | 76 } // namespace content |
| OLD | NEW |