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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java

Issue 1326593006: Add the Physical Web to Chrome on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handled jdduke's comments Created 5 years, 3 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/physicalweb/PhysicalWeb.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
new file mode 100644
index 0000000000000000000000000000000000000000..367f229ef9049377e641cc347dad7d93b3d2e993
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
@@ -0,0 +1,39 @@
+// Copyright 2015 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.physicalweb;
+
+import org.chromium.base.CommandLine;
+import org.chromium.chrome.browser.ChromeApplication;
+import org.chromium.chrome.browser.ChromeSwitches;
+import org.chromium.chrome.browser.ChromeVersionInfo;
+
+/**
+ * This class provides the basic interface to the Physical Web feature.
+ */
+public class PhysicalWeb {
+ /**
+ * Evaluate whether the environment is one in which the Physical Web should
+ * be enabled.
+ * @return true if the PhysicalWeb should be enabled
+ */
+ public static boolean featureIsEnabled() {
+ boolean allowedChannel =
+ ChromeVersionInfo.isLocalBuild() || ChromeVersionInfo.isDevBuild();
+ boolean switchEnabled =
+ CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_PHYSICAL_WEB);
+ return allowedChannel && switchEnabled;
+ }
+
+ /**
+ * Start the Physical Web feature.
+ * At the moment, this only enables URL discovery over BLE.
+ * @param application An instance of {@link ChromeApplication}, used to get the
+ * appropriate PhysicalWebBleClient implementation.
+ */
+ public static void startPhysicalWeb(ChromeApplication application) {
+ PhysicalWebBleClient physicalWebBleClient = PhysicalWebBleClient.getInstance(application);
+ physicalWebBleClient.subscribe();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698