Commit adc1382f authored by Liquan (Max) Gu's avatar Liquan (Max) Gu Committed by Commit Bot

[PaymentHandler] Comments for readability

Added comments:
* Comment why the ref over the weak-ref is chosen for WebContents.
* Comment why using an abbreviation.

Bug: 999196

Change-Id: I94eddbed050e131865869ac09521fa7275d48619
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1912912Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Commit-Queue: Liquan (Max) Gu <maxlg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714834}
parent f90ba1c2
...@@ -23,7 +23,10 @@ import org.chromium.ui.modelutil.PropertyModel; ...@@ -23,7 +23,10 @@ import org.chromium.ui.modelutil.PropertyModel;
extends WebContentsObserver implements BottomSheetObserver { extends WebContentsObserver implements BottomSheetObserver {
private final PropertyModel mModel; private final PropertyModel mModel;
private final Runnable mHider; private final Runnable mHider;
/** Postfixed with "Ref" to distinguish from mWebContent in WebContentsObserver. */ // Postfixed with "Ref" to distinguish from mWebContent in WebContentsObserver. Although
// referencing the same object, mWebContentsRef is preferable to WebContents here because
// mWebContents (a weak ref) requires null checks, while mWebContentsRef is guaranteed to be not
// null.
private final WebContents mWebContentsRef; private final WebContents mWebContentsRef;
/** /**
...@@ -37,6 +40,7 @@ import org.chromium.ui.modelutil.PropertyModel; ...@@ -37,6 +40,7 @@ import org.chromium.ui.modelutil.PropertyModel;
/* package */ PaymentHandlerMediator( /* package */ PaymentHandlerMediator(
PropertyModel model, Runnable hider, WebContents webContents) { PropertyModel model, Runnable hider, WebContents webContents) {
super(webContents); super(webContents);
assert webContents != null;
mWebContentsRef = webContents; mWebContentsRef = webContents;
mModel = model; mModel = model;
mHider = hider; mHider = hider;
......
...@@ -26,6 +26,7 @@ import java.net.URISyntaxException; ...@@ -26,6 +26,7 @@ import java.net.URISyntaxException;
* notifies the backend (the coordinator). * notifies the backend (the coordinator).
*/ */
/* package */ class PaymentHandlerToolbarMediator extends WebContentsObserver { /* package */ class PaymentHandlerToolbarMediator extends WebContentsObserver {
// Abbreviated for the length limit.
private static final String TAG = "PaymentHandlerTb"; private static final String TAG = "PaymentHandlerTb";
/** The delay (four video frames - for 60Hz) after which the hide progress will be hidden. */ /** The delay (four video frames - for 60Hz) after which the hide progress will be hidden. */
private static final long HIDE_PROGRESS_BAR_DELAY_MS = (1000 / 60) * 4; private static final long HIDE_PROGRESS_BAR_DELAY_MS = (1000 / 60) * 4;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment