OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/screen_orientation/screen_orientation_delegate_android
.h" |
| 6 |
| 7 #include "content/browser/android/content_view_core_impl.h" |
| 8 #include "jni/ScreenOrientationProvider_jni.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 ScreenOrientationDelegateAndroid::ScreenOrientationDelegateAndroid() { |
| 13 } |
| 14 |
| 15 ScreenOrientationDelegateAndroid::~ScreenOrientationDelegateAndroid() { |
| 16 } |
| 17 |
| 18 // static |
| 19 bool ScreenOrientationDelegateAndroid::Register(JNIEnv* env) { |
| 20 return RegisterNativesImpl(env); |
| 21 } |
| 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( |
| 36 WebContents* web_contents) { |
| 37 ContentViewCoreImpl* cvc = |
| 38 ContentViewCoreImpl::FromWebContents(web_contents); |
| 39 bool fullscreen_required = cvc ? cvc->IsFullscreenRequiredForOrientationLock() |
| 40 : true; |
| 41 return fullscreen_required; |
| 42 } |
| 43 |
| 44 void ScreenOrientationDelegateAndroid::Lock( |
| 45 blink::WebScreenOrientationLockType lock_orientation) { |
| 46 Java_ScreenOrientationProvider_lockOrientation( |
| 47 base::android::AttachCurrentThread(), lock_orientation); |
| 48 } |
| 49 |
| 50 bool ScreenOrientationDelegateAndroid::ScreenOrientationProviderSupported() { |
| 51 // Always supported on Android |
| 52 return true; |
| 53 } |
| 54 |
| 55 void ScreenOrientationDelegateAndroid::Unlock() { |
| 56 Java_ScreenOrientationProvider_unlockOrientation( |
| 57 base::android::AttachCurrentThread()); |
| 58 } |
| 59 |
| 60 } // namespace content |
OLD | NEW |