Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionFactory.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionFactory.java |
| index 7048c67ba0b91b123c96a7a026d365ddb5ea4f7b..ee410644a1f55d0d9279bddc98da83fa4ee85390 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionFactory.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/shapedetection/TextDetectionFactory.java |
| @@ -4,37 +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.TextDetection; |
| -import org.chromium.ui.base.WindowAndroid; |
| /** |
| * Factory class registered to create TextDetections upon request. |
| */ |
| public class TextDetectionFactory implements InterfaceFactory<TextDetection> { |
| - private final WebContents mWebContents; |
| + private final Context mContext; |
| - public TextDetectionFactory(WebContents webContents) { |
| - mWebContents = webContents; |
| + public TextDetectionFactory(Context context) { |
| + mContext = context; |
| } |
| @Override |
| public TextDetection 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 TextDetectionImpl(context); |
| + return new TextDetectionImpl(mContext); |
| } |
|
mcasas
2017/01/18 02:05:10
Hmm these Factory classes are so small, that we co
xianglu
2017/01/18 02:22:30
Make sense. Will do in a follow-up CL, since this
|
| } |