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

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

Issue 2776243007: Enable WebVR presentation from Chrome Custom Tab (Closed)
Patch Set: Remove file IO, fix PendingIntent errors Created 3 years, 8 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/VrProxyActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrProxyActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrProxyActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..2ff0826d4993426ed49bd37c77bf7042c2770a3a
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrProxyActivity.java
@@ -0,0 +1,36 @@
+// Copyright 2017 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.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+import org.chromium.base.Log;
+
+/**
+ * Dispatches incoming intents to the appropriate VR activity based on the VR intent extras.
+ */
+public class VrProxyActivity extends Activity {
+ private static final String TAG = "VrProxyActivity";
+
+ // The permission is required for listening for VR DON flow results.
+ private static final String PERMISSION_VR_ENTRY = "VR_ENTRY";
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ int target = getIntent().getIntExtra(VrShellDelegate.TARGET_EXTRA, -1);
+ if (target == -1) {
+ Log.e(TAG, "Failed to enter VR");
+ finish();
+ return;
+ }
+ Intent intent = new Intent(VrShellDelegate.VR_ENTRY_RESULT_ACTION);
+ intent.putExtra(VrShellDelegate.TARGET_EXTRA, target);
+ sendBroadcast(intent, getPackageName() + ".permission." + PERMISSION_VR_ENTRY);
+ finish();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698