| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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.content.browser; |
| 6 |
| 7 import android.app.Activity; |
| 8 |
| 9 import org.chromium.base.Callback; |
| 10 import org.chromium.base.annotations.CalledByNative; |
| 11 import org.chromium.device.nfc.NfcDelegate; |
| 12 |
| 13 /** |
| 14 * A //content-specific implementation of the NfcDelegate interface. Maps NFC |
| 15 * host ideas to their corresponding NfcHost objects, allowing the NFC |
| 16 * implementation to access the Activity of the WebContents with which its |
| 17 * requesting frame is associated. |
| 18 */ |
| 19 public class ContentNfcDelegate implements NfcDelegate { |
| 20 @CalledByNative |
| 21 static ContentNfcDelegate create() { |
| 22 return new ContentNfcDelegate(); |
| 23 } |
| 24 |
| 25 public void trackActivityForHost(int hostId, Callback<Activity> callback) { |
| 26 NfcHost host = NfcHost.fromContextId(hostId); |
| 27 if (host == null) { |
| 28 return; |
| 29 } |
| 30 host.trackActivityChanges(callback); |
| 31 } |
| 32 |
| 33 public void stopTrackingActivityForHost(int hostId) { |
| 34 NfcHost host = NfcHost.fromContextId(hostId); |
| 35 if (host == null) { |
| 36 return; |
| 37 } |
| 38 host.stopTrackingActivityChanges(); |
| 39 } |
| 40 } |
| OLD | NEW |