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

Side by Side Diff: device/vr/android/java/src/org/chromium/device/vr/GvrDeviceProvider.java

Issue 2398103002: Enable magic window mode with new Gvr (Closed)
Patch Set: reviews Created 4 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 unified diff | Download patch
« no previous file with comments | « device/vr/android/gvr/gvr_device_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 package org.chromium.device.vr;
6
7 import android.content.Context;
8 import android.os.StrictMode;
9
10 import com.google.vr.ndk.base.GvrLayout;
11
12 import org.chromium.base.Log;
13 import org.chromium.base.annotations.CalledByNative;
14 import org.chromium.base.annotations.JNINamespace;
15
16 /**
17 * This is the implementation of the C++ counterpart GvrDeviceProvider.
18 */
19 @JNINamespace("device")
20 class GvrDeviceProvider {
21 private static final String TAG = "GvrDeviceProvider";
22 private final GvrLayout mLayout;
23
24 private GvrDeviceProvider(Context context) {
25 mLayout = new GvrLayout(context);
26 }
27
28 @CalledByNative
29 private static GvrDeviceProvider create(Context context) {
30 return new GvrDeviceProvider(context);
31 }
32
33 @CalledByNative
34 private long getNativeContext() {
35 long nativeGvrContext = 0;
36
37 StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
38
39 try {
40 nativeGvrContext = mLayout.getGvrApi().getNativeGvrContext();
41 } catch (Exception ex) {
42 Log.e(TAG, "Unable to instantiate GvrApi", ex);
43 return 0;
44 } finally {
45 StrictMode.setThreadPolicy(oldPolicy);
46 }
47
48 return nativeGvrContext;
49 }
50
51 @CalledByNative
52 private void shutdown() {
53 mLayout.shutdown();
54 }
55 }
OLDNEW
« no previous file with comments | « device/vr/android/gvr/gvr_device_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698