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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/CreditCardScanner.java

Issue 2801033002: Revert of Android: Remove GetApplicationContext part 2 (Closed)
Patch Set: Created 3 years, 8 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: chrome/android/java/src/org/chromium/chrome/browser/autofill/CreditCardScanner.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CreditCardScanner.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/CreditCardScanner.java
index 68715f19b84ad7ee11be3d2b4a4886026de61252..d78e4591c27c045aa7dfe05f3d22df5803e8179b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/CreditCardScanner.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/CreditCardScanner.java
@@ -3,6 +3,8 @@
// found in the LICENSE file.
package org.chromium.chrome.browser.autofill;
+
+import android.content.Context;
import org.chromium.base.annotations.SuppressFBWarnings;
import org.chromium.content_public.browser.WebContents;
@@ -22,6 +24,10 @@
/** The delegate to notify of scanning result. */
protected final Delegate mDelegate;
+ /** Application context. Used in subclass. */
+ @SuppressFBWarnings({"URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"})
+ protected final Context mContext;
+
/** The web contents that's requesting a scan. Used in subclass. */
@SuppressFBWarnings({"URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD"})
protected final WebContents mWebContents;
@@ -31,11 +37,12 @@
/**
* Builds an instance of credit card scanner.
*
+ * @param context Application context.
* @param webContents The web contents that are requesting a scan.
* @param delegate The delegate to notify of scanning result.
* @return An object that can scan a credit card.
*/
- CreditCardScanner create(WebContents webContents, Delegate delegate);
+ CreditCardScanner create(Context context, WebContents webContents, Delegate delegate);
}
/** The delegate for credit card scanning. */
@@ -69,21 +76,26 @@
/**
* Creates an instance of a credit card scanner.
*
+ * @param context Application context.
* @param webContents The web contents that are requesting a scan.
* @param delegate The delegate to notify of scanning result.
* @return An object that can scan a credit card.
*/
- public static CreditCardScanner create(WebContents webContents, Delegate delegate) {
- return sFactory != null ? sFactory.create(webContents, delegate)
- : new CreditCardScanner(webContents, delegate);
+ public static CreditCardScanner create(
+ Context context, WebContents webContents, Delegate delegate) {
+ return sFactory != null ? sFactory.create(context, webContents, delegate)
+ : new CreditCardScanner(context, webContents, delegate);
}
/**
* Constructor for the credit card scanner.
- * @param webContents The web contents that are requesting a scan.
+ *
+ * @param context Application context.
+ * @param webContents The web contents that are requesting a scan.
* @param delegate The delegate to notify of scanning result.
*/
- protected CreditCardScanner(WebContents webContents, Delegate delegate) {
+ protected CreditCardScanner(Context context, WebContents webContents, Delegate delegate) {
+ mContext = context;
mWebContents = webContents;
mDelegate = delegate;
}

Powered by Google App Engine
This is Rietveld 408576698