| 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/public/browser/screen_orientation_provider.h" | 5 #include "content/public/browser/screen_orientation_provider.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_view_host_delegate.h" | 7 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 8 #include "content/public/browser/render_view_host.h" | 8 #include "content/public/browser/render_view_host.h" |
| 9 #include "content/public/browser/screen_orientation_delegate.h" | 9 #include "content/public/browser/screen_orientation_delegate.h" |
| 10 #include "content/public/browser/screen_orientation_dispatcher_host.h" | 10 #include "content/public/browser/screen_orientation_dispatcher_host.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 dispatcher_->NotifyLockError(request_id, | 40 dispatcher_->NotifyLockError(request_id, |
| 41 blink::WebLockOrientationErrorNotAvailable); | 41 blink::WebLockOrientationErrorNotAvailable); |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 | 44 |
| 45 if (delegate_->FullScreenRequired(web_contents())) { | 45 if (delegate_->FullScreenRequired(web_contents())) { |
| 46 RenderViewHost* rvh = web_contents()->GetRenderViewHost(); | 46 RenderViewHost* rvh = web_contents()->GetRenderViewHost(); |
| 47 if (!rvh) { | 47 if (!rvh) { |
| 48 dispatcher_->NotifyLockError(request_id, | 48 dispatcher_->NotifyLockError(request_id, |
| 49 blink::WebLockOrientationErrorCanceled); | 49 blink::WebLockOrientationErrorCanceled); |
| 50 return; |
| 50 } | 51 } |
| 51 RenderViewHostDelegate* rvhd = rvh->GetDelegate(); | 52 RenderViewHostDelegate* rvhd = rvh->GetDelegate(); |
| 52 if (!rvhd) { | 53 if (!rvhd) { |
| 53 dispatcher_->NotifyLockError(request_id, | 54 dispatcher_->NotifyLockError(request_id, |
| 54 blink::WebLockOrientationErrorCanceled); | 55 blink::WebLockOrientationErrorCanceled); |
| 56 return; |
| 55 } | 57 } |
| 56 if (!rvhd->IsFullscreenForCurrentTab()) { | 58 if (!rvhd->IsFullscreenForCurrentTab()) { |
| 57 dispatcher_->NotifyLockError(request_id, | 59 dispatcher_->NotifyLockError(request_id, |
| 58 blink::WebLockOrientationErrorFullScreenRequired); | 60 blink::WebLockOrientationErrorFullScreenRequired); |
| 61 return; |
| 59 } | 62 } |
| 60 return; | |
| 61 } | 63 } |
| 62 | 64 |
| 63 if (lock_orientation == blink::WebScreenOrientationLockNatural) { | 65 if (lock_orientation == blink::WebScreenOrientationLockNatural) { |
| 64 lock_orientation = GetNaturalLockType(); | 66 lock_orientation = GetNaturalLockType(); |
| 65 if (lock_orientation == blink::WebScreenOrientationLockDefault) { | 67 if (lock_orientation == blink::WebScreenOrientationLockDefault) { |
| 66 // We are in a broken state, let's pretend we got canceled. | 68 // We are in a broken state, let's pretend we got canceled. |
| 67 dispatcher_->NotifyLockError(request_id, | 69 dispatcher_->NotifyLockError(request_id, |
| 68 blink::WebLockOrientationErrorCanceled); | 70 blink::WebLockOrientationErrorCanceled); |
| 69 return; | 71 return; |
| 70 } | 72 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 case blink::WebScreenOrientationLockDefault: | 200 case blink::WebScreenOrientationLockDefault: |
| 199 NOTREACHED(); | 201 NOTREACHED(); |
| 200 return false; | 202 return false; |
| 201 } | 203 } |
| 202 | 204 |
| 203 NOTREACHED(); | 205 NOTREACHED(); |
| 204 return false; | 206 return false; |
| 205 } | 207 } |
| 206 | 208 |
| 207 } // namespace content | 209 } // namespace content |
| OLD | NEW |