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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentNfcDelegate.java

Issue 2865653002: [Device Service] Decouple NFC implementation from //content (Closed)
Patch Set: extra fix Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698