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

Side by Side Diff: content/browser/screen_orientation/screen_orientation_provider_android.cc

Issue 196193002: Implement ScreenOrientationProvider for Chrome Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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 unified diff | Download patch
OLDNEW
(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_provider_android .h"
6
7 #include "content/browser/screen_orientation/screen_orientation_dispatcher_host. h"
8 #include "jni/ScreenOrientationProvider_jni.h"
9
10 namespace content {
11
12 ScreenOrientationProviderAndroid::ScreenOrientationProviderAndroid() {
13 }
14
15 ScreenOrientationProviderAndroid::~ScreenOrientationProviderAndroid() {
16 }
17
18 // static
19 bool ScreenOrientationProviderAndroid::Register(JNIEnv* env) {
20 return RegisterNativesImpl(env);
21 }
22
23 void ScreenOrientationProviderAndroid::LockOrientation(
24 blink::WebScreenOrientations orientations) {
25 if (j_screen_orientation_provider_.is_null()) {
26 j_screen_orientation_provider_.Reset(Java_ScreenOrientationProvider_create(
27 base::android::AttachCurrentThread()));
28 }
29
30 Java_ScreenOrientationProvider_lockOrientation(
31 base::android::AttachCurrentThread(),
32 j_screen_orientation_provider_.obj(), orientations);
33 }
34
35 void ScreenOrientationProviderAndroid::UnlockOrientation() {
36 // j_screen_orientation_provider_ is set when locking. If the screen
37 // orientation was not locked, unlocking should be a no-op.
38 if (j_screen_orientation_provider_.is_null())
39 return;
40
41 Java_ScreenOrientationProvider_unlockOrientation(
42 base::android::AttachCurrentThread(),
43 j_screen_orientation_provider_.obj());
44 }
45
46 // static
47 ScreenOrientationProvider* ScreenOrientationDispatcherHost::CreateProvider() {
48 return new ScreenOrientationProviderAndroid();
49 }
50
51 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/screen_orientation/screen_orientation_provider_android.h ('k') | content/content.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698