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 #include "content/public/browser/render_frame_host.h" | 9 #include "content/public/browser/render_frame_host.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 void ScreenOrientationDispatcherHost::OnLockRequest( | 96 void ScreenOrientationDispatcherHost::OnLockRequest( |
97 RenderFrameHost* render_frame_host, | 97 RenderFrameHost* render_frame_host, |
98 blink::WebScreenOrientationLockType orientation, | 98 blink::WebScreenOrientationLockType orientation, |
99 int request_id) { | 99 int request_id) { |
100 if (current_lock_) { | 100 if (current_lock_) { |
101 NotifyLockError(current_lock_->request_id, | 101 NotifyLockError(current_lock_->request_id, |
102 blink::WebLockOrientationErrorCanceled); | 102 blink::WebLockOrientationErrorCanceled); |
103 } | 103 } |
104 | 104 |
105 current_lock_ = new LockInformation(request_id, | |
106 render_frame_host->GetProcess()->GetID(), | |
107 render_frame_host->GetRoutingID()); | |
108 | |
109 if (!provider_) { | 105 if (!provider_) { |
110 NotifyLockError(request_id, | 106 NotifyLockError(request_id, |
111 blink::WebLockOrientationErrorNotAvailable); | 107 blink::WebLockOrientationErrorNotAvailable); |
112 return; | 108 return; |
113 } | 109 } |
114 | 110 |
| 111 current_lock_ = new LockInformation(request_id, |
| 112 render_frame_host->GetProcess()->GetID(), |
| 113 render_frame_host->GetRoutingID()); |
| 114 |
115 provider_->LockOrientation(request_id, orientation); | 115 provider_->LockOrientation(request_id, orientation); |
116 } | 116 } |
117 | 117 |
118 void ScreenOrientationDispatcherHost::OnUnlockRequest( | 118 void ScreenOrientationDispatcherHost::OnUnlockRequest( |
119 RenderFrameHost* render_frame_host) { | 119 RenderFrameHost* render_frame_host) { |
120 if (current_lock_) { | 120 if (current_lock_) { |
121 NotifyLockError(current_lock_->request_id, | 121 NotifyLockError(current_lock_->request_id, |
122 blink::WebLockOrientationErrorCanceled); | 122 blink::WebLockOrientationErrorCanceled); |
123 } | 123 } |
124 | 124 |
125 if (!provider_.get()) | 125 if (!provider_) |
126 return; | 126 return; |
127 | 127 |
128 provider_->UnlockOrientation(); | 128 provider_->UnlockOrientation(); |
129 } | 129 } |
130 | 130 |
131 } // namespace content | 131 } // namespace content |
OLD | NEW |