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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/NfcFactory.java

Issue 2865653002: [Device Service] Decouple NFC implementation from //content (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/NfcFactory.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/NfcFactory.java b/content/public/android/java/src/org/chromium/content/browser/NfcFactory.java
deleted file mode 100644
index 35268c12c7f2624e0cdc402df93e07f98a314b40..0000000000000000000000000000000000000000
--- a/content/public/android/java/src/org/chromium/content/browser/NfcFactory.java
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2016 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.content.browser;
-
-import android.app.Activity;
-
-import org.chromium.content_public.browser.WebContents;
-import org.chromium.device.nfc.NfcImpl;
-import org.chromium.device.nfc.mojom.Nfc;
-import org.chromium.services.service_manager.InterfaceFactory;
-import org.chromium.ui.base.WindowAndroid;
-
-class NfcFactory implements InterfaceFactory<Nfc> {
- private final WebContents mContents;
-
- NfcFactory(WebContents contents) {
- mContents = contents;
- }
-
- private static class ContextAwareNfcImpl
- extends NfcImpl implements WindowAndroidChangedObserver {
- private final ContentViewCore mContentViewCore;
-
- ContextAwareNfcImpl(ContentViewCore contentViewCore) {
- super(contentViewCore.getContext().getApplicationContext());
- mContentViewCore = contentViewCore;
- mContentViewCore.addWindowAndroidChangedObserver(this);
- if (mContentViewCore.getWindowAndroid() != null) {
- setActivity(mContentViewCore.getWindowAndroid().getActivity().get());
- }
- }
-
- @Override
- public void close() {
- super.close();
- if (mContentViewCore != null) {
- mContentViewCore.removeWindowAndroidChangedObserver(this);
- }
- }
-
- @Override
- public void onWindowAndroidChanged(WindowAndroid newWindowAndroid) {
- Activity activity = null;
- if (newWindowAndroid != null) {
- activity = newWindowAndroid.getActivity().get();
- }
- setActivity(activity);
- }
- }
-
- @Override
- public Nfc createImpl() {
- ContentViewCore contentViewCore = ContentViewCore.fromWebContents(mContents);
- if (contentViewCore == null) {
- return null;
- }
- return new ContextAwareNfcImpl(contentViewCore);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698