| 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_delegate_android
.h" | 5 #include "content/browser/screen_orientation/screen_orientation_delegate_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_provider.h" | 8 #include "content/browser/screen_orientation/screen_orientation_provider.h" |
| 9 #include "jni/ScreenOrientationProvider_jni.h" | 9 #include "jni/ScreenOrientationProvider_jni.h" |
| 10 #include "ui/android/window_android.h" | 10 #include "ui/android/window_android.h" |
| 11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 ScreenOrientationDelegateAndroid::ScreenOrientationDelegateAndroid() { | 15 ScreenOrientationDelegateAndroid::ScreenOrientationDelegateAndroid() { |
| 16 ScreenOrientationProvider::SetDelegate(this); | 16 ScreenOrientationProvider::SetDelegate(this); |
| 17 } | 17 } |
| 18 | 18 |
| 19 ScreenOrientationDelegateAndroid::~ScreenOrientationDelegateAndroid() { | 19 ScreenOrientationDelegateAndroid::~ScreenOrientationDelegateAndroid() { |
| 20 ScreenOrientationProvider::SetDelegate(nullptr); | 20 ScreenOrientationProvider::SetDelegate(nullptr); |
| 21 } | 21 } |
| 22 | 22 |
| 23 // static | |
| 24 void ScreenOrientationDelegateAndroid::StartAccurateListening() { | |
| 25 Java_ScreenOrientationProvider_startAccurateListening( | |
| 26 base::android::AttachCurrentThread()); | |
| 27 } | |
| 28 | |
| 29 // static | |
| 30 void ScreenOrientationDelegateAndroid::StopAccurateListening() { | |
| 31 Java_ScreenOrientationProvider_stopAccurateListening( | |
| 32 base::android::AttachCurrentThread()); | |
| 33 } | |
| 34 | |
| 35 bool ScreenOrientationDelegateAndroid::FullScreenRequired( | 23 bool ScreenOrientationDelegateAndroid::FullScreenRequired( |
| 36 WebContents* web_contents) { | 24 WebContents* web_contents) { |
| 37 ContentViewCoreImpl* cvc = | 25 ContentViewCoreImpl* cvc = |
| 38 ContentViewCoreImpl::FromWebContents(web_contents); | 26 ContentViewCoreImpl::FromWebContents(web_contents); |
| 39 bool fullscreen_required = cvc ? cvc->IsFullscreenRequiredForOrientationLock() | 27 bool fullscreen_required = cvc ? cvc->IsFullscreenRequiredForOrientationLock() |
| 40 : true; | 28 : true; |
| 41 return fullscreen_required; | 29 return fullscreen_required; |
| 42 } | 30 } |
| 43 | 31 |
| 44 void ScreenOrientationDelegateAndroid::Lock( | 32 void ScreenOrientationDelegateAndroid::Lock( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 } | 45 } |
| 58 | 46 |
| 59 void ScreenOrientationDelegateAndroid::Unlock(WebContents* web_contents) { | 47 void ScreenOrientationDelegateAndroid::Unlock(WebContents* web_contents) { |
| 60 gfx::NativeWindow window = web_contents->GetTopLevelNativeWindow(); | 48 gfx::NativeWindow window = web_contents->GetTopLevelNativeWindow(); |
| 61 Java_ScreenOrientationProvider_unlockOrientation( | 49 Java_ScreenOrientationProvider_unlockOrientation( |
| 62 base::android::AttachCurrentThread(), | 50 base::android::AttachCurrentThread(), |
| 63 window ? window->GetJavaObject() : nullptr); | 51 window ? window->GetJavaObject() : nullptr); |
| 64 } | 52 } |
| 65 | 53 |
| 66 } // namespace content | 54 } // namespace content |
| OLD | NEW |