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_provider_android
.h" | 5 #include "content/browser/screen_orientation/screen_orientation_provider_android
.h" |
6 | 6 |
7 #include "content/browser/android/content_view_core_impl.h" | 7 #include "content/browser/android/content_view_core_impl.h" |
8 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" | 8 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host.
h" |
9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 if (LockMatchesCurrentOrientation(pending_lock_->lock)) { | 115 if (LockMatchesCurrentOrientation(pending_lock_->lock)) { |
116 dispatcher_->NotifyLockSuccess(pending_lock_->request_id); | 116 dispatcher_->NotifyLockSuccess(pending_lock_->request_id); |
117 delete pending_lock_; | 117 delete pending_lock_; |
118 pending_lock_ = NULL; | 118 pending_lock_ = NULL; |
119 } | 119 } |
120 } | 120 } |
121 | 121 |
122 void ScreenOrientationProviderAndroid::DidToggleFullscreenModeForTab( | 122 void ScreenOrientationProviderAndroid::DidToggleFullscreenModeForTab( |
123 bool entered_fullscreen) { | 123 bool entered_fullscreen) { |
124 if (lock_applied_) { | 124 if (!lock_applied_) |
125 DCHECK(!entered_fullscreen); | 125 return; |
126 UnlockOrientation(); | 126 |
127 } | 127 // If fullscreen is not required in order to lock orientation, don't unlock |
| 128 // when fullscreen state changes. |
| 129 ContentViewCoreImpl* cvc = |
| 130 ContentViewCoreImpl::FromWebContents(web_contents()); |
| 131 if (cvc && !cvc->IsFullscreenRequiredForOrientationLock()) |
| 132 return; |
| 133 |
| 134 DCHECK(!entered_fullscreen); |
| 135 UnlockOrientation(); |
128 } | 136 } |
129 | 137 |
130 bool ScreenOrientationProviderAndroid::LockMatchesCurrentOrientation( | 138 bool ScreenOrientationProviderAndroid::LockMatchesCurrentOrientation( |
131 blink::WebScreenOrientationLockType lock_orientation) { | 139 blink::WebScreenOrientationLockType lock_orientation) { |
132 if (!web_contents()->GetRenderViewHost()) | 140 if (!web_contents()->GetRenderViewHost()) |
133 return false; | 141 return false; |
134 | 142 |
135 RenderWidgetHost* rwh = web_contents()->GetRenderViewHost(); | 143 RenderWidgetHost* rwh = web_contents()->GetRenderViewHost(); |
136 blink::WebScreenInfo screen_info; | 144 blink::WebScreenInfo screen_info; |
137 rwh->GetWebScreenInfo(&screen_info); | 145 rwh->GetWebScreenInfo(&screen_info); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 } | 225 } |
218 | 226 |
219 // static | 227 // static |
220 ScreenOrientationProvider* ScreenOrientationProvider::Create( | 228 ScreenOrientationProvider* ScreenOrientationProvider::Create( |
221 ScreenOrientationDispatcherHost* dispatcher, | 229 ScreenOrientationDispatcherHost* dispatcher, |
222 WebContents* web_contents) { | 230 WebContents* web_contents) { |
223 return new ScreenOrientationProviderAndroid(dispatcher, web_contents); | 231 return new ScreenOrientationProviderAndroid(dispatcher, web_contents); |
224 } | 232 } |
225 | 233 |
226 } // namespace content | 234 } // namespace content |
OLD | NEW |