| 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::OnDestruct() { |
| 35 delete this; |
| 36 } |
| 37 |
| 34 void ScreenOrientationDispatcher::OnLockSuccess(int request_id) { | 38 void ScreenOrientationDispatcher::OnLockSuccess(int request_id) { |
| 35 blink::WebLockOrientationCallback* callback = | 39 blink::WebLockOrientationCallback* callback = |
| 36 pending_callbacks_.Lookup(request_id); | 40 pending_callbacks_.Lookup(request_id); |
| 37 if (!callback) | 41 if (!callback) |
| 38 return; | 42 return; |
| 39 callback->onSuccess(); | 43 callback->onSuccess(); |
| 40 pending_callbacks_.Remove(request_id); | 44 pending_callbacks_.Remove(request_id); |
| 41 } | 45 } |
| 42 | 46 |
| 43 void ScreenOrientationDispatcher::OnLockError( | 47 void ScreenOrientationDispatcher::OnLockError( |
| (...skipping 23 matching lines...) Expand all Loading... |
| 67 Send(new ScreenOrientationHostMsg_LockRequest( | 71 Send(new ScreenOrientationHostMsg_LockRequest( |
| 68 routing_id(), orientation, request_id)); | 72 routing_id(), orientation, request_id)); |
| 69 } | 73 } |
| 70 | 74 |
| 71 void ScreenOrientationDispatcher::unlockOrientation() { | 75 void ScreenOrientationDispatcher::unlockOrientation() { |
| 72 CancelPendingLocks(); | 76 CancelPendingLocks(); |
| 73 Send(new ScreenOrientationHostMsg_Unlock(routing_id())); | 77 Send(new ScreenOrientationHostMsg_Unlock(routing_id())); |
| 74 } | 78 } |
| 75 | 79 |
| 76 } // namespace content | 80 } // namespace content |
| OLD | NEW |