Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBleClient.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBleClient.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBleClient.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..262f6f7051542cb3eb75887a01e286fb7fa5cc76 |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWebBleClient.java |
| @@ -0,0 +1,46 @@ |
| +// 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 android.app.Application; |
| + |
| +import org.chromium.base.Log; |
| +import org.chromium.chrome.browser.ChromeApplication; |
| + |
| +/** |
| + * The Client that harvests URLs from BLE signals. |
| + * This class is designed to scan URSs from Bluetooth Low Energy beacons. |
| + * This class is currently an empty implementation and must be extended by a |
| + * subclass. |
| + */ |
| +public class PhysicalWebBleClient { |
| + private static PhysicalWebBleClient sInstance = null; |
| + private static final String TAG = "PhysicalWeb"; |
| + |
| + /** |
| + * Get a singleton instance of this class. |
| + * @param application An instance of {@link Application}, which should be a |
| + * {@link ChromeApplication}, used to get the appropriate PhysicalWebBleClient |
| + * implementation. |
| + * @return an instance of this class (or subclass) as decided by the |
| + * application parameter |
| + */ |
| + @SuppressWarnings("unchecked") |
| + public static PhysicalWebBleClient getInstance(Application application) { |
|
jdduke (slow)
2015/09/30 21:56:23
Any reason we can't pass in a ChromeApplication di
cco3
2015/10/01 01:19:04
I was just copying the pattern I saw in CustomTabs
|
| + if (sInstance == null) { |
| + ChromeApplication chromeApplication = (ChromeApplication) application; |
| + sInstance = chromeApplication.createPhysicalWebBleClient(); |
| + } |
| + return sInstance; |
| + } |
| + |
| + /** |
| + * Begin subscribing to URLs broadcasted from BLE beacons. |
| + * This currently does nothing and should be overridden by a subclass. |
| + */ |
| + void subscribe() { |
| + Log.d(TAG, "subscribing in empty client"); |
| + } |
| +} |