cc: Make picture pile base thread safe.
[chromium-blink-merge.git] / content / browser / screen_orientation / screen_orientation_delegate_android.cc
blobbb2f5bc61f9d0d3f0dae48774010b36e7b1963d6
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 blink::WebScreenOrientationLockType lock_orientation) {
46 Java_ScreenOrientationProvider_lockOrientation(
47 base::android::AttachCurrentThread(), lock_orientation);
50 bool ScreenOrientationDelegateAndroid::ScreenOrientationProviderSupported() {
51 // Always supported on Android
52 return true;
55 void ScreenOrientationDelegateAndroid::Unlock() {
56 Java_ScreenOrientationProvider_unlockOrientation(
57 base::android::AttachCurrentThread());
60 } // namespace content