Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(747)

Unified Diff: content/browser/screen_orientation/screen_orientation_delegate_android.cc

Issue 546453004: Centralize ScreenOrientationProvider logic, add platform delegates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screen_orientation_public_impl_split
Patch Set: Remove Factory Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/screen_orientation/screen_orientation_delegate_android.cc
diff --git a/content/browser/screen_orientation/screen_orientation_delegate_android.cc b/content/browser/screen_orientation/screen_orientation_delegate_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bb2f5bc61f9d0d3f0dae48774010b36e7b1963d6
--- /dev/null
+++ b/content/browser/screen_orientation/screen_orientation_delegate_android.cc
@@ -0,0 +1,60 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/screen_orientation/screen_orientation_delegate_android.h"
+
+#include "content/browser/android/content_view_core_impl.h"
+#include "jni/ScreenOrientationProvider_jni.h"
+
+namespace content {
+
+ScreenOrientationDelegateAndroid::ScreenOrientationDelegateAndroid() {
+}
+
+ScreenOrientationDelegateAndroid::~ScreenOrientationDelegateAndroid() {
+}
+
+// static
+bool ScreenOrientationDelegateAndroid::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+// static
+void ScreenOrientationDelegateAndroid::StartAccurateListening() {
+ Java_ScreenOrientationProvider_startAccurateListening(
+ base::android::AttachCurrentThread());
+}
+
+// static
+void ScreenOrientationDelegateAndroid::StopAccurateListening() {
+ Java_ScreenOrientationProvider_stopAccurateListening(
+ base::android::AttachCurrentThread());
+}
+
+bool ScreenOrientationDelegateAndroid::FullScreenRequired(
+ WebContents* web_contents) {
+ ContentViewCoreImpl* cvc =
+ ContentViewCoreImpl::FromWebContents(web_contents);
+ bool fullscreen_required = cvc ? cvc->IsFullscreenRequiredForOrientationLock()
+ : true;
+ return fullscreen_required;
+}
+
+void ScreenOrientationDelegateAndroid::Lock(
+ blink::WebScreenOrientationLockType lock_orientation) {
+ Java_ScreenOrientationProvider_lockOrientation(
+ base::android::AttachCurrentThread(), lock_orientation);
+}
+
+bool ScreenOrientationDelegateAndroid::ScreenOrientationProviderSupported() {
+ // Always supported on Android
+ return true;
+}
+
+void ScreenOrientationDelegateAndroid::Unlock() {
+ Java_ScreenOrientationProvider_unlockOrientation(
+ base::android::AttachCurrentThread());
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698