OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.physicalweb; | 5 package org.chromium.chrome.browser.physicalweb; |
6 | 6 |
7 import android.app.Activity; | 7 import android.app.Activity; |
8 | 8 |
9 import com.google.android.gms.common.api.GoogleApiClient; | 9 import com.google.android.gms.common.api.GoogleApiClient; |
10 import com.google.android.gms.nearby.Nearby; | 10 import com.google.android.gms.nearby.Nearby; |
11 import com.google.android.gms.nearby.messages.Message; | 11 import com.google.android.gms.nearby.messages.Message; |
12 import com.google.android.gms.nearby.messages.MessageFilter; | 12 import com.google.android.gms.nearby.messages.MessageFilter; |
13 import com.google.android.gms.nearby.messages.MessageListener; | 13 import com.google.android.gms.nearby.messages.MessageListener; |
14 | 14 |
15 import org.chromium.base.ContextUtils; | 15 import org.chromium.base.ContextUtils; |
16 import org.chromium.base.Log; | 16 import org.chromium.base.Log; |
17 import org.chromium.chrome.browser.ChromeApplication; | 17 import org.chromium.chrome.browser.ChromeApplication; |
18 | 18 |
19 | 19 |
20 /** | 20 /** |
21 * The Client that harvests URLs from BLE signals. | 21 * The Client that harvests URLs from BLE signals. |
22 * This class is designed to scan URSs from Bluetooth Low Energy beacons. | 22 * This class is designed to scan URSs from Bluetooth Low Energy beacons. |
23 * This class is currently an empty implementation and must be extended by a | 23 * This class is currently an empty implementation and must be extended by a |
24 * subclass. | 24 * subclass. |
25 */ | 25 */ |
26 public class PhysicalWebBleClient { | 26 public class PhysicalWebBleClient { |
27 private static PhysicalWebBleClient sInstance = null; | 27 private static PhysicalWebBleClient sInstance; |
28 private static final String TAG = "PhysicalWeb"; | 28 private static final String TAG = "PhysicalWeb"; |
29 | 29 |
30 // We don't actually listen to any of the onFound or onLost events in the fo
reground. | 30 // We don't actually listen to any of the onFound or onLost events in the fo
reground. |
31 // The background listener will get these. | 31 // The background listener will get these. |
32 protected static class ForegroundMessageListener extends MessageListener { | 32 protected static class ForegroundMessageListener extends MessageListener { |
33 @Override | 33 @Override |
34 public void onFound(Message message) {} | 34 public void onFound(Message message) {} |
35 } | 35 } |
36 | 36 |
37 protected static class BackgroundMessageListener extends MessageListener { | 37 protected static class BackgroundMessageListener extends MessageListener { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 /** | 160 /** |
161 * Modify a MessageFilter.Builder as necessary for doing Physical Web scanni
ng. | 161 * Modify a MessageFilter.Builder as necessary for doing Physical Web scanni
ng. |
162 * @param builder The builder to be modified. | 162 * @param builder The builder to be modified. |
163 * @return The Builder. | 163 * @return The Builder. |
164 */ | 164 */ |
165 MessageFilter.Builder modifyMessageFilterBuilder(MessageFilter.Builder build
er) { | 165 MessageFilter.Builder modifyMessageFilterBuilder(MessageFilter.Builder build
er) { |
166 return builder.includeAllMyTypes(); | 166 return builder.includeAllMyTypes(); |
167 } | 167 } |
168 } | 168 } |
OLD | NEW |