| Index: chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionFactory.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionFactory.java
|
| index 03c349f5d5363babaea3a9b8771850a3e06aabf1..40ba7b8a0a55f38acb56661653bca07a9ad281b3 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionFactory.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/BarcodeDetectionFactory.java
|
| @@ -4,36 +4,23 @@
|
|
|
| package org.chromium.chrome.browser.shapedetection;
|
|
|
| -import android.app.Activity;
|
| +import android.content.Context;
|
|
|
| -import org.chromium.content.browser.ContentViewCore;
|
| -import org.chromium.content_public.browser.WebContents;
|
| import org.chromium.services.service_manager.InterfaceFactory;
|
| import org.chromium.shape_detection.mojom.BarcodeDetection;
|
| -import org.chromium.ui.base.WindowAndroid;
|
|
|
| /**
|
| * Factory class registered to create BarcodeDetections upon request.
|
| */
|
| public class BarcodeDetectionFactory implements InterfaceFactory<BarcodeDetection> {
|
| - private final WebContents mWebContents;
|
| + private final Context mContext;
|
|
|
| - public BarcodeDetectionFactory(WebContents webContents) {
|
| - mWebContents = webContents;
|
| + public BarcodeDetectionFactory(Context context) {
|
| + mContext = context;
|
| }
|
|
|
| @Override
|
| public BarcodeDetection createImpl() {
|
| - // Get android.content.Context out of |mWebContents|.
|
| - final ContentViewCore contentViewCore = ContentViewCore.fromWebContents(mWebContents);
|
| - if (contentViewCore == null) return null;
|
| -
|
| - final WindowAndroid window = contentViewCore.getWindowAndroid();
|
| - if (window == null) return null;
|
| -
|
| - final Activity context = window.getActivity().get();
|
| - if (context == null) return null;
|
| -
|
| - return new BarcodeDetectionImpl(context);
|
| + return new BarcodeDetectionImpl(mContext);
|
| }
|
| }
|
|
|