[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / screen_orientation / screen_orientation_delegate_android.cc
blob839b24c901bd7318beaa89283ee0d21c27697a39
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.
5 #include "content/browser/screen_orientation/screen_orientation_delegate_android.h"
7 #include "content/browser/android/content_view_core_impl.h"
8 #include "jni/ScreenOrientationProvider_jni.h"
10 namespace content {
12 ScreenOrientationDelegateAndroid::ScreenOrientationDelegateAndroid() {
15 ScreenOrientationDelegateAndroid::~ScreenOrientationDelegateAndroid() {
18 // static
19 bool ScreenOrientationDelegateAndroid::Register(JNIEnv* env) {
20 return RegisterNativesImpl(env);
23 // static
24 void ScreenOrientationDelegateAndroid::StartAccurateListening() {
25 Java_ScreenOrientationProvider_startAccurateListening(
26 base::android::AttachCurrentThread());
29 // static
30 void ScreenOrientationDelegateAndroid::StopAccurateListening() {
31 Java_ScreenOrientationProvider_stopAccurateListening(
32 base::android::AttachCurrentThread());
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;
44 void ScreenOrientationDelegateAndroid::Lock(
45 WebContents* web_contents,
46 blink::WebScreenOrientationLockType lock_orientation) {
47 Java_ScreenOrientationProvider_lockOrientation(
48 base::android::AttachCurrentThread(), lock_orientation);
51 bool ScreenOrientationDelegateAndroid::ScreenOrientationProviderSupported() {
52 // Always supported on Android
53 return true;
56 void ScreenOrientationDelegateAndroid::Unlock(WebContents* web_contents) {
57 Java_ScreenOrientationProvider_unlockOrientation(
58 base::android::AttachCurrentThread());
61 } // namespace content