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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrDaydreamApiImpl.java

Issue 2428563003: Launch Chrome when phone inserted into Daydream headset IFF Chrome was the active app (Closed)
Patch Set: review 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrDaydreamApiImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrDaydreamApiImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrDaydreamApiImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..69755f3f2c2b25e6743066c92383a1a4ccccc4d8
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrDaydreamApiImpl.java
@@ -0,0 +1,46 @@
+// Copyright 2016 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.
+
+package org.chromium.chrome.browser.vr_shell;
+
+import android.app.PendingIntent;
+import android.content.Context;
+
+import com.google.vr.ndk.base.DaydreamApi;
+
+import org.chromium.base.annotations.UsedByReflection;
+
+/**
+ * A wrapper for DaydreamApi.
+ */
+@UsedByReflection("VrShellDelegate.java")
+public class VrDaydreamApiImpl implements VrDaydreamApi {
+ private DaydreamApi mDaydreamApi;
+
+ @UsedByReflection("VrShellDelegate.java")
+ public VrDaydreamApiImpl(Context context) {
+ mDaydreamApi = DaydreamApi.create(context);
+ }
+
+ @Override
+ public void registerDaydreamIntent(PendingIntent pendingIntent) {
+ if (mDaydreamApi != null) {
+ mDaydreamApi.registerDaydreamIntent(pendingIntent);
+ }
+ }
+ @Override
+ public void unregisterDaydreamIntent() {
+ if (mDaydreamApi != null) {
+ mDaydreamApi.unregisterDaydreamIntent();
+ }
+ }
+
+ @Override
+ public void close() {
+ if (mDaydreamApi != null) {
+ mDaydreamApi.close();
+ }
+ mDaydreamApi = null;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698