Chromium Code Reviews| OLD | NEW | 
|---|---|
| (Empty) | |
| 1 // Copyright 2015 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.chrome.browser.physicalweb; | |
| 6 | |
| 7 import android.app.Application; | |
| 8 | |
| 9 import org.chromium.base.Log; | |
| 10 import org.chromium.chrome.browser.ChromeApplication; | |
| 11 | |
| 12 /** | |
| 13 * The Client that harvests URLs from BLE signals. | |
| 14 * This class is designed to scan URSs from Bluetooth Low Energy beacons. | |
| 15 * This class is currently an empty implementation and must be extended by a | |
| 16 * subclass. | |
| 17 */ | |
| 18 public class PhysicalWebBleClient { | |
| 19 private static PhysicalWebBleClient sInstance = null; | |
| 20 private static final String TAG = "PhysicalWeb"; | |
| 21 | |
| 22 /** | |
| 23 * Get a singleton instance of this class. | |
| 24 * @param application An instance of {@link Application}, which should be a | |
| 25 * {@link ChromeApplication}, used to get the appropriate PhysicalWebBleClie nt | |
| 26 * implementation. | |
| 27 * @return an instance of this class (or subclass) as decided by the | |
| 28 * application parameter | |
| 29 */ | |
| 30 @SuppressWarnings("unchecked") | |
| 31 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
 
 | |
| 32 if (sInstance == null) { | |
| 33 ChromeApplication chromeApplication = (ChromeApplication) applicatio n; | |
| 34 sInstance = chromeApplication.createPhysicalWebBleClient(); | |
| 35 } | |
| 36 return sInstance; | |
| 37 } | |
| 38 | |
| 39 /** | |
| 40 * Begin subscribing to URLs broadcasted from BLE beacons. | |
| 41 * This currently does nothing and should be overridden by a subclass. | |
| 42 */ | |
| 43 void subscribe() { | |
| 44 Log.d(TAG, "subscribing in empty client"); | |
| 45 } | |
| 46 } | |
| OLD | NEW |