Commit bfabce08 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[Web Payment] Rename microtransaction to minimal UI.

Bug: 1005076
Change-Id: I16e45e91ee3d6ac3dcb92f6967ea786b1b0f7840
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2097301
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750541}
parent f260d671
...@@ -1323,11 +1323,11 @@ chrome_java_sources = [ ...@@ -1323,11 +1323,11 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarProperties.java", "java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarProperties.java",
"java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarView.java", "java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarView.java",
"java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarViewBinder.java", "java/src/org/chromium/chrome/browser/payments/handler/toolbar/PaymentHandlerToolbarViewBinder.java",
"java/src/org/chromium/chrome/browser/payments/micro/MicrotransactionCoordinator.java", "java/src/org/chromium/chrome/browser/payments/minimal/MinimalUICoordinator.java",
"java/src/org/chromium/chrome/browser/payments/micro/MicrotransactionMediator.java", "java/src/org/chromium/chrome/browser/payments/minimal/MinimalUIMediator.java",
"java/src/org/chromium/chrome/browser/payments/micro/MicrotransactionProperties.java", "java/src/org/chromium/chrome/browser/payments/minimal/MinimalUIProperties.java",
"java/src/org/chromium/chrome/browser/payments/micro/MicrotransactionView.java", "java/src/org/chromium/chrome/browser/payments/minimal/MinimalUIView.java",
"java/src/org/chromium/chrome/browser/payments/micro/MicrotransactionViewBinder.java", "java/src/org/chromium/chrome/browser/payments/minimal/MinimalUIViewBinder.java",
"java/src/org/chromium/chrome/browser/payments/ui/AnimatorProperties.java", "java/src/org/chromium/chrome/browser/payments/ui/AnimatorProperties.java",
"java/src/org/chromium/chrome/browser/payments/ui/ContactDetailsSection.java", "java/src/org/chromium/chrome/browser/payments/ui/ContactDetailsSection.java",
"java/src/org/chromium/chrome/browser/payments/ui/DimmingDialog.java", "java/src/org/chromium/chrome/browser/payments/ui/DimmingDialog.java",
......
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toStartOf="@+id/payment_currency" android:layout_toStartOf="@+id/payment_currency"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingBottom="@dimen/microtransaction_large_text_vertical_spacing" android:paddingBottom="@dimen/payment_minimal_ui_large_text_vertical_spacing"
android:paddingEnd="@dimen/microtransaction_spacing" android:paddingEnd="@dimen/payment_minimal_ui_spacing"
android:paddingStart="@dimen/microtransaction_spacing" android:paddingStart="@dimen/payment_minimal_ui_spacing"
android:paddingTop="@dimen/microtransaction_content_top_spacing" android:paddingTop="@dimen/payment_minimal_ui_content_top_spacing"
android:textAppearance="@style/TextAppearance.TextMedium.Secondary" android:textAppearance="@style/TextAppearance.TextMedium.Secondary"
android:text="@string/payment_request_payment_method_section_name"/> android:text="@string/payment_request_payment_method_section_name"/>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toStartOf="@+id/payment_amount" android:layout_toStartOf="@+id/payment_amount"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingTop="@dimen/microtransaction_content_top_spacing" android:paddingTop="@dimen/payment_minimal_ui_content_top_spacing"
android:textAppearance="@style/TextAppearance.TextMedium.Primary"/> android:textAppearance="@style/TextAppearance.TextMedium.Primary"/>
<!-- Bold formatted amount, e.g., "$1.00". --> <!-- Bold formatted amount, e.g., "$1.00". -->
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingEnd="@dimen/microtransaction_spacing" android:paddingEnd="@dimen/payment_minimal_ui_spacing"
android:paddingStart="@dimen/microtransaction_amount_currency_spacing" android:paddingStart="@dimen/payment_minimal_ui_amount_currency_spacing"
android:paddingTop="@dimen/microtransaction_content_top_spacing" android:paddingTop="@dimen/payment_minimal_ui_content_top_spacing"
android:textAppearance="@style/TextAppearance.TextMediumThick.Primary"/> android:textAppearance="@style/TextAppearance.TextMediumThick.Primary"/>
<!-- Line item separator. --> <!-- Line item separator. -->
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
android:background="@color/divider_bg_color" android:background="@color/divider_bg_color"
android:id="@+id/line_item_separator" android:id="@+id/line_item_separator"
android:layout_below="@id/payment_label" android:layout_below="@id/payment_label"
android:layout_height="@dimen/microtransaction_separator_width" android:layout_height="@dimen/payment_minimal_ui_separator_width"
android:layout_marginEnd="@dimen/microtransaction_spacing" android:layout_marginEnd="@dimen/payment_minimal_ui_spacing"
android:layout_marginStart="@dimen/microtransaction_spacing" android:layout_marginStart="@dimen/payment_minimal_ui_spacing"
android:layout_width="match_parent"/> android:layout_width="match_parent"/>
<!-- "Account Balance" label. --> <!-- "Account Balance" label. -->
...@@ -60,10 +60,10 @@ ...@@ -60,10 +60,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toStartOf="@+id/account_balance_currency" android:layout_toStartOf="@+id/account_balance_currency"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingBottom="@dimen/microtransaction_large_text_vertical_spacing" android:paddingBottom="@dimen/payment_minimal_ui_large_text_vertical_spacing"
android:paddingEnd="@dimen/microtransaction_spacing" android:paddingEnd="@dimen/payment_minimal_ui_spacing"
android:paddingStart="@dimen/microtransaction_spacing" android:paddingStart="@dimen/payment_minimal_ui_spacing"
android:paddingTop="@dimen/microtransaction_large_text_vertical_spacing" android:paddingTop="@dimen/payment_minimal_ui_large_text_vertical_spacing"
android:textAppearance="@style/TextAppearance.TextMedium.Secondary" android:textAppearance="@style/TextAppearance.TextMedium.Secondary"
android:text="@string/payment_account_balance"/> android:text="@string/payment_account_balance"/>
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toStartOf="@+id/account_balance" android:layout_toStartOf="@+id/account_balance"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingTop="@dimen/microtransaction_large_text_vertical_spacing" android:paddingTop="@dimen/payment_minimal_ui_large_text_vertical_spacing"
android:textAppearance="@style/TextAppearance.TextMedium.Primary"/> android:textAppearance="@style/TextAppearance.TextMedium.Primary"/>
<!-- Bold formatted account balance, e.g., "$18.00". --> <!-- Bold formatted account balance, e.g., "$18.00". -->
...@@ -84,9 +84,9 @@ ...@@ -84,9 +84,9 @@
android:layout_below="@id/line_item_separator" android:layout_below="@id/line_item_separator"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingEnd="@dimen/microtransaction_spacing" android:paddingEnd="@dimen/payment_minimal_ui_spacing"
android:paddingStart="@dimen/microtransaction_amount_currency_spacing" android:paddingStart="@dimen/payment_minimal_ui_amount_currency_spacing"
android:paddingTop="@dimen/microtransaction_large_text_vertical_spacing" android:paddingTop="@dimen/payment_minimal_ui_large_text_vertical_spacing"
android:textAppearance="@style/TextAppearance.TextMediumThick.Primary"/> android:textAppearance="@style/TextAppearance.TextMediumThick.Primary"/>
<!-- Status icon, e.g., the fingerprint icon. --> <!-- Status icon, e.g., the fingerprint icon. -->
...@@ -95,9 +95,9 @@ ...@@ -95,9 +95,9 @@
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:layout_below="@id/account_balance_label" android:layout_below="@id/account_balance_label"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_height="@dimen/microtransaction_content_icon_size" android:layout_height="@dimen/payment_minimal_ui_content_icon_size"
android:layout_margin="@dimen/microtransaction_content_icon_spacing" android:layout_margin="@dimen/payment_minimal_ui_content_icon_spacing"
android:layout_width="@dimen/microtransaction_content_icon_size" android:layout_width="@dimen/payment_minimal_ui_content_icon_size"
android:scaleType="centerCrop"/> android:scaleType="centerCrop"/>
<!-- Processing spinner. --> <!-- Processing spinner. -->
...@@ -105,9 +105,9 @@ ...@@ -105,9 +105,9 @@
android:id="@+id/processing_spinner" android:id="@+id/processing_spinner"
android:layout_below="@id/account_balance_label" android:layout_below="@id/account_balance_label"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_height="@dimen/microtransaction_content_icon_size" android:layout_height="@dimen/payment_minimal_ui_content_icon_size"
android:layout_margin="@dimen/microtransaction_content_icon_spacing" android:layout_margin="@dimen/payment_minimal_ui_content_icon_spacing"
android:layout_width="@dimen/microtransaction_content_icon_size"/> android:layout_width="@dimen/payment_minimal_ui_content_icon_size"/>
<!-- Status message, e.g., "Touch sensor to pay". --> <!-- Status message, e.g., "Touch sensor to pay". -->
<TextView <TextView
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingBottom="@dimen/microtransaction_content_bottom_spacing" android:paddingBottom="@dimen/payment_minimal_ui_content_bottom_spacing"
android:textAppearance="@style/TextAppearance.TextSmall.Secondary"/> android:textAppearance="@style/TextAppearance.TextSmall.Secondary"/>
<!-- "Pay" button. --> <!-- "Pay" button. -->
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_below="@id/account_balance" android:layout_below="@id/account_balance"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/microtransaction_spacing" android:layout_margin="@dimen/payment_minimal_ui_spacing"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:text="@string/payments_pay_button" android:text="@string/payments_pay_button"
style="@style/FilledButton.Flat"/> style="@style/FilledButton.Flat"/>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:padding="@dimen/microtransaction_drag_handle_spacing" android:padding="@dimen/payment_minimal_ui_drag_handle_spacing"
android:src="@drawable/drag_handlebar"/> android:src="@drawable/drag_handlebar"/>
<!-- Payment app icon. --> <!-- Payment app icon. -->
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:layout_alignParentStart="true" android:layout_alignParentStart="true"
android:layout_below="@id/drag_handle" android:layout_below="@id/drag_handle"
android:layout_height="@dimen/microtransaction_toolbar_icon_size" android:layout_height="@dimen/payment_minimal_ui_toolbar_icon_size"
android:layout_marginBottom="@dimen/microtransaction_app_icon_bottom_spacing" android:layout_marginBottom="@dimen/payment_minimal_ui_app_icon_bottom_spacing"
android:layout_marginEnd="@dimen/microtransaction_app_icon_horizontal_spacing" android:layout_marginEnd="@dimen/payment_minimal_ui_app_icon_horizontal_spacing"
android:layout_marginStart="@dimen/microtransaction_app_icon_horizontal_spacing" android:layout_marginStart="@dimen/payment_minimal_ui_app_icon_horizontal_spacing"
android:layout_width="@dimen/microtransaction_toolbar_icon_size" android:layout_width="@dimen/payment_minimal_ui_toolbar_icon_size"
android:scaleType="centerCrop"/> android:scaleType="centerCrop"/>
<!-- Large status message, e.g., "Not recognized" or "Complete". --> <!-- Large status message, e.g., "Not recognized" or "Complete". -->
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toEndOf="@id/payment_app_icon" android:layout_toEndOf="@id/payment_app_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingTop="@dimen/microtransaction_large_text_vertical_spacing" android:paddingTop="@dimen/payment_minimal_ui_large_text_vertical_spacing"
android:textAppearance="@style/TextAppearance.TextMedium.Primary"/> android:textAppearance="@style/TextAppearance.TextMedium.Primary"/>
<!-- Payment app name, e.g., "Bob Pay". --> <!-- Payment app name, e.g., "Bob Pay". -->
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toEndOf="@id/payment_app_icon" android:layout_toEndOf="@id/payment_app_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingTop="@dimen/microtransaction_large_text_vertical_spacing" android:paddingTop="@dimen/payment_minimal_ui_large_text_vertical_spacing"
android:textAppearance="@style/TextAppearance.TextLarge.Primary"/> android:textAppearance="@style/TextAppearance.TextLarge.Primary"/>
<!-- Small emphasized status message, e.g., "Touch sensor to pay". --> <!-- Small emphasized status message, e.g., "Touch sensor to pay". -->
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toEndOf="@id/payment_app_icon" android:layout_toEndOf="@id/payment_app_icon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingTop="@dimen/microtransaction_toolbar_small_status_text_top_spacing" android:paddingTop="@dimen/payment_minimal_ui_toolbar_small_status_text_top_spacing"
android:textAppearance="@style/TextAppearance.TextSmall.Blue"/> android:textAppearance="@style/TextAppearance.TextSmall.Blue"/>
<!-- Currency label, e.g., "USD". --> <!-- Currency label, e.g., "USD". -->
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toEndOf="@id/currency" android:layout_toEndOf="@id/currency"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:paddingStart="@dimen/microtransaction_amount_currency_spacing" android:paddingStart="@dimen/payment_minimal_ui_amount_currency_spacing"
android:textAppearance="@style/TextAppearance.TextMediumThick.Primary"/> android:textAppearance="@style/TextAppearance.TextMediumThick.Primary"/>
<!-- Status icon, e.g., the fingerprint icon. --> <!-- Status icon, e.g., the fingerprint icon. -->
...@@ -88,10 +88,10 @@ ...@@ -88,10 +88,10 @@
android:importantForAccessibility="no" android:importantForAccessibility="no"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_below="@id/drag_handle" android:layout_below="@id/drag_handle"
android:layout_height="@dimen/microtransaction_toolbar_icon_size" android:layout_height="@dimen/payment_minimal_ui_toolbar_icon_size"
android:layout_marginEnd="@dimen/microtransaction_spacing" android:layout_marginEnd="@dimen/payment_minimal_ui_spacing"
android:layout_marginStart="@dimen/microtransaction_spacing" android:layout_marginStart="@dimen/payment_minimal_ui_spacing"
android:layout_width="@dimen/microtransaction_toolbar_icon_size" android:layout_width="@dimen/payment_minimal_ui_toolbar_icon_size"
android:scaleType="centerCrop"/> android:scaleType="centerCrop"/>
<!-- Processing spinner. --> <!-- Processing spinner. -->
...@@ -99,10 +99,10 @@ ...@@ -99,10 +99,10 @@
android:id="@+id/processing_spinner" android:id="@+id/processing_spinner"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_below="@id/drag_handle" android:layout_below="@id/drag_handle"
android:layout_height="@dimen/microtransaction_toolbar_icon_size" android:layout_height="@dimen/payment_minimal_ui_toolbar_icon_size"
android:layout_marginEnd="@dimen/microtransaction_spacing" android:layout_marginEnd="@dimen/payment_minimal_ui_spacing"
android:layout_marginStart="@dimen/microtransaction_spacing" android:layout_marginStart="@dimen/payment_minimal_ui_spacing"
android:layout_width="@dimen/microtransaction_toolbar_icon_size"/> android:layout_width="@dimen/payment_minimal_ui_toolbar_icon_size"/>
<!-- "Pay" button. --> <!-- "Pay" button. -->
<org.chromium.ui.widget.ButtonCompat <org.chromium.ui.widget.ButtonCompat
...@@ -110,8 +110,8 @@ ...@@ -110,8 +110,8 @@
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_below="@id/drag_handle" android:layout_below="@id/drag_handle"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/microtransaction_spacing" android:layout_marginEnd="@dimen/payment_minimal_ui_spacing"
android:layout_marginStart="@dimen/microtransaction_spacing" android:layout_marginStart="@dimen/payment_minimal_ui_spacing"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:text="@string/payments_pay_button" android:text="@string/payments_pay_button"
style="@style/FilledButton.Flat"/> style="@style/FilledButton.Flat"/>
......
...@@ -499,22 +499,22 @@ ...@@ -499,22 +499,22 @@
<dimen name="payments_request_bottom_bar_vertical_padding">10dp</dimen> <dimen name="payments_request_bottom_bar_vertical_padding">10dp</dimen>
<dimen name="payments_request_bottom_bar_horizontal_padding">16dp</dimen> <dimen name="payments_request_bottom_bar_horizontal_padding">16dp</dimen>
<!-- Microtransaction UI spacing --> <!-- Payment minimal UI spacing -->
<dimen name="microtransaction_amount_currency_spacing">4dp</dimen> <dimen name="payment_minimal_ui_amount_currency_spacing">4dp</dimen>
<dimen name="microtransaction_app_icon_bottom_spacing">20dp</dimen> <dimen name="payment_minimal_ui_app_icon_bottom_spacing">20dp</dimen>
<dimen name="microtransaction_app_icon_horizontal_spacing">10dp</dimen> <dimen name="payment_minimal_ui_app_icon_horizontal_spacing">10dp</dimen>
<dimen name="microtransaction_content_bottom_spacing">26dp</dimen> <dimen name="payment_minimal_ui_content_bottom_spacing">26dp</dimen>
<dimen name="microtransaction_content_icon_spacing">8dp</dimen> <dimen name="payment_minimal_ui_content_icon_spacing">8dp</dimen>
<dimen name="microtransaction_content_top_spacing">78dp</dimen> <dimen name="payment_minimal_ui_content_top_spacing">78dp</dimen>
<dimen name="microtransaction_drag_handle_spacing">8dp</dimen> <dimen name="payment_minimal_ui_drag_handle_spacing">8dp</dimen>
<dimen name="microtransaction_large_text_vertical_spacing">8dp</dimen> <dimen name="payment_minimal_ui_large_text_vertical_spacing">8dp</dimen>
<dimen name="microtransaction_spacing">16dp</dimen> <dimen name="payment_minimal_ui_spacing">16dp</dimen>
<dimen name="microtransaction_toolbar_small_status_text_top_spacing">2dp</dimen> <dimen name="payment_minimal_ui_toolbar_small_status_text_top_spacing">2dp</dimen>
<!-- Microtransaction UI element sizes --> <!-- Payment minimal UI element sizes -->
<dimen name="microtransaction_content_icon_size">56dp</dimen> <dimen name="payment_minimal_ui_content_icon_size">56dp</dimen>
<dimen name="microtransaction_separator_width">0.5dp</dimen> <dimen name="payment_minimal_ui_separator_width">0.5dp</dimen>
<dimen name="microtransaction_toolbar_icon_size">36dp</dimen> <dimen name="payment_minimal_ui_toolbar_icon_size">36dp</dimen>
<!-- Preferences dimensions <!-- Preferences dimensions
pref_autofill_field_horizontal_padding exists because TextInputLayouts have an internal pref_autofill_field_horizontal_padding exists because TextInputLayouts have an internal
......
...@@ -35,9 +35,6 @@ public abstract class PaymentApp extends EditableOption { ...@@ -35,9 +35,6 @@ public abstract class PaymentApp extends EditableOption {
*/ */
protected boolean mHaveRequestedAutofillData; protected boolean mHaveRequestedAutofillData;
/** Whether the app should be invoked for a microtransaction. */
protected boolean mIsMicrotransaction;
/** /**
* The interface for listener to payment method, shipping address, and shipping option change * The interface for listener to payment method, shipping address, and shipping option change
* events. Note: What the spec calls "payment methods" in the context of a "change event", this * events. Note: What the spec calls "payment methods" in the context of a "change event", this
......
...@@ -32,7 +32,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList; ...@@ -32,7 +32,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList;
import org.chromium.chrome.browser.payments.handler.PaymentHandlerCoordinator; import org.chromium.chrome.browser.payments.handler.PaymentHandlerCoordinator;
import org.chromium.chrome.browser.payments.handler.PaymentHandlerCoordinator.PaymentHandlerUiObserver; import org.chromium.chrome.browser.payments.handler.PaymentHandlerCoordinator.PaymentHandlerUiObserver;
import org.chromium.chrome.browser.payments.handler.PaymentHandlerCoordinator.PaymentHandlerWebContentsObserver; import org.chromium.chrome.browser.payments.handler.PaymentHandlerCoordinator.PaymentHandlerWebContentsObserver;
import org.chromium.chrome.browser.payments.micro.MicrotransactionCoordinator; import org.chromium.chrome.browser.payments.minimal.MinimalUICoordinator;
import org.chromium.chrome.browser.payments.ui.ContactDetailsSection; import org.chromium.chrome.browser.payments.ui.ContactDetailsSection;
import org.chromium.chrome.browser.payments.ui.LineItem; import org.chromium.chrome.browser.payments.ui.LineItem;
import org.chromium.chrome.browser.payments.ui.PaymentInformation; import org.chromium.chrome.browser.payments.ui.PaymentInformation;
...@@ -472,7 +472,7 @@ public class PaymentRequestImpl ...@@ -472,7 +472,7 @@ public class PaymentRequestImpl
private List<PaymentApp> mPendingApps = new ArrayList<>(); private List<PaymentApp> mPendingApps = new ArrayList<>();
private SectionInformation mPaymentMethodsSection; private SectionInformation mPaymentMethodsSection;
private PaymentRequestUI mUI; private PaymentRequestUI mUI;
private MicrotransactionCoordinator mMicrotransactionUi; private MinimalUICoordinator mMinimalUi;
private Callback<PaymentInformation> mPaymentInformationCallback; private Callback<PaymentInformation> mPaymentInformationCallback;
private PaymentApp mInvokedPaymentApp; private PaymentApp mInvokedPaymentApp;
private PaymentHandlerCoordinator mPaymentHandlerUi; private PaymentHandlerCoordinator mPaymentHandlerUi;
...@@ -993,7 +993,7 @@ public class PaymentRequestImpl ...@@ -993,7 +993,7 @@ public class PaymentRequestImpl
public void show(boolean isUserGesture, boolean waitForUpdatedDetails) { public void show(boolean isUserGesture, boolean waitForUpdatedDetails) {
if (mClient == null) return; if (mClient == null) return;
if (mUI != null || mMicrotransactionUi != null) { if (mUI != null || mMinimalUi != null) {
// Can be triggered only by a compromised renderer. In normal operation, calling show() // Can be triggered only by a compromised renderer. In normal operation, calling show()
// twice on the same instance of PaymentRequest in JavaScript is rejected at the // twice on the same instance of PaymentRequest in JavaScript is rejected at the
// renderer level. // renderer level.
...@@ -1066,8 +1066,8 @@ public class PaymentRequestImpl ...@@ -1066,8 +1066,8 @@ public class PaymentRequestImpl
assert !mPaymentMethodsSection.isEmpty(); assert !mPaymentMethodsSection.isEmpty();
assert mUI != null; assert mUI != null;
if (isMicrotransactionUiApplicable()) { if (isMinimalUiApplicable()) {
triggerMicrotransactionUi(chromeActivity); triggerMinimalUi(chromeActivity);
return; return;
} }
...@@ -1088,8 +1088,8 @@ public class PaymentRequestImpl ...@@ -1088,8 +1088,8 @@ public class PaymentRequestImpl
} }
} }
/** @return Whether the microtransaction UI should be shown. */ /** @return Whether the minimal UI should be shown. */
private boolean isMicrotransactionUiApplicable() { private boolean isMinimalUiApplicable() {
if (!mIsUserGestureShow || mPaymentMethodsSection == null if (!mIsUserGestureShow || mPaymentMethodsSection == null
|| mPaymentMethodsSection.getSize() != 1) { || mPaymentMethodsSection.getSize() != 1) {
return false; return false;
...@@ -1104,50 +1104,49 @@ public class PaymentRequestImpl ...@@ -1104,50 +1104,49 @@ public class PaymentRequestImpl
} }
/** /**
* Triggers the microtransaction UI. * Triggers the minimal UI.
* @param chromeActivity The Android activity for the Chrome UI that will host the * @param chromeActivity The Android activity for the Chrome UI that will host the minimal UI.
* microtransaction UI.
*/ */
private void triggerMicrotransactionUi(ChromeActivity chromeActivity) { private void triggerMinimalUi(ChromeActivity chromeActivity) {
// Do not show the Payment Request UI dialog even if the minimal UI is suppressed. // Do not show the Payment Request UI dialog even if the minimal UI is suppressed.
mPaymentUisShowStateReconciler.onBottomSheetShown(); mPaymentUisShowStateReconciler.onBottomSheetShown();
mMicrotransactionUi = new MicrotransactionCoordinator(); mMinimalUi = new MinimalUICoordinator();
if (mMicrotransactionUi.show(chromeActivity, chromeActivity.getBottomSheetController(), if (mMinimalUi.show(chromeActivity, chromeActivity.getBottomSheetController(),
(PaymentApp) mPaymentMethodsSection.getSelectedItem(), (PaymentApp) mPaymentMethodsSection.getSelectedItem(),
mCurrencyFormatterMap.get(mRawTotal.amount.currency), mCurrencyFormatterMap.get(mRawTotal.amount.currency),
mUiShoppingCart.getTotal(), this::onMinimalUIReady, mUiShoppingCart.getTotal(), this::onMinimalUIReady, this::onMinimalUiConfirmed,
this::onMicrotransactionUiConfirmed, this::onMicrotransactionUiDismissed)) { this::onMinimalUiDismissed)) {
mDidRecordShowEvent = true; mDidRecordShowEvent = true;
mShouldRecordAbortReason = true; mShouldRecordAbortReason = true;
mJourneyLogger.setEventOccurred(Event.SHOWN); mJourneyLogger.setEventOccurred(Event.SHOWN);
return; return;
} }
disconnectFromClientWithDebugMessage(ErrorStrings.MICROTRANSACTION_UI_SUPPRESSED); disconnectFromClientWithDebugMessage(ErrorStrings.MINIMAL_UI_SUPPRESSED);
} }
private void onMinimalUIReady() { private void onMinimalUIReady() {
if (mNativeObserverForTest != null) mNativeObserverForTest.onMinimalUIReady(); if (mNativeObserverForTest != null) mNativeObserverForTest.onMinimalUIReady();
} }
private void onMicrotransactionUiConfirmed(PaymentApp app) { private void onMinimalUiConfirmed(PaymentApp app) {
mJourneyLogger.recordTransactionAmount( mJourneyLogger.recordTransactionAmount(
mRawTotal.amount.currency, mRawTotal.amount.value, false /*completed*/); mRawTotal.amount.currency, mRawTotal.amount.value, false /*completed*/);
app.disableShowingOwnUI(); app.disableShowingOwnUI();
onPayClicked(null /* selectedShippingAddress */, null /* selectedShippingOption */, app); onPayClicked(null /* selectedShippingAddress */, null /* selectedShippingOption */, app);
} }
private void onMicrotransactionUiDismissed() { private void onMinimalUiDismissed() {
onDismiss(); onDismiss();
} }
private void onMicrotransactionUiErroredAndClosed() { private void onMinimalUiErroredAndClosed() {
closeClient(); closeClient();
closeUIAndDestroyNativeObjects(); closeUIAndDestroyNativeObjects();
} }
private void onMicrotransactionUiCompletedAndClosed() { private void onMinimalUiCompletedAndClosed() {
if (mClient != null) mClient.onComplete(); if (mClient != null) mClient.onComplete();
closeClient(); closeClient();
closeUIAndDestroyNativeObjects(); closeUIAndDestroyNativeObjects();
...@@ -1323,8 +1322,8 @@ public class PaymentRequestImpl ...@@ -1323,8 +1322,8 @@ public class PaymentRequestImpl
@VisibleForTesting(otherwise = VisibleForTesting.NONE) @VisibleForTesting(otherwise = VisibleForTesting.NONE)
private boolean confirmMinimalUIForTestInternal() { private boolean confirmMinimalUIForTestInternal() {
if (mMicrotransactionUi == null) return false; if (mMinimalUi == null) return false;
mMicrotransactionUi.confirmForTest(); mMinimalUi.confirmForTest();
return true; return true;
} }
...@@ -1341,8 +1340,8 @@ public class PaymentRequestImpl ...@@ -1341,8 +1340,8 @@ public class PaymentRequestImpl
@VisibleForTesting(otherwise = VisibleForTesting.NONE) @VisibleForTesting(otherwise = VisibleForTesting.NONE)
private boolean dismissMinimalUIForTestInternal() { private boolean dismissMinimalUIForTestInternal() {
if (mMicrotransactionUi == null) return false; if (mMinimalUi == null) return false;
mMicrotransactionUi.dismissForTest(); mMinimalUi.dismissForTest();
return true; return true;
} }
...@@ -2265,13 +2264,12 @@ public class PaymentRequestImpl ...@@ -2265,13 +2264,12 @@ public class PaymentRequestImpl
PaymentPreferencesUtil.setPaymentAppLastUseDate( PaymentPreferencesUtil.setPaymentAppLastUseDate(
selectedPaymentMethod.getIdentifier(), System.currentTimeMillis()); selectedPaymentMethod.getIdentifier(), System.currentTimeMillis());
if (mMicrotransactionUi != null) { if (mMinimalUi != null) {
if (result == PaymentComplete.FAIL) { if (result == PaymentComplete.FAIL) {
mMicrotransactionUi.showErrorAndClose(this::onMicrotransactionUiErroredAndClosed, mMinimalUi.showErrorAndClose(
R.string.payments_error_message); this::onMinimalUiErroredAndClosed, R.string.payments_error_message);
} else { } else {
mMicrotransactionUi.showCompleteAndClose( mMinimalUi.showCompleteAndClose(this::onMinimalUiCompletedAndClosed);
this::onMicrotransactionUiCompletedAndClosed);
} }
return; return;
} }
...@@ -2882,10 +2880,10 @@ public class PaymentRequestImpl ...@@ -2882,10 +2880,10 @@ public class PaymentRequestImpl
public void onInstrumentDetailsError(String errorMessage) { public void onInstrumentDetailsError(String errorMessage) {
if (mClient == null) return; if (mClient == null) return;
mInvokedPaymentApp = null; mInvokedPaymentApp = null;
if (mMicrotransactionUi != null) { if (mMinimalUi != null) {
mJourneyLogger.setAborted(AbortReason.ABORTED_BY_USER); mJourneyLogger.setAborted(AbortReason.ABORTED_BY_USER);
mMicrotransactionUi.showErrorAndClose( mMinimalUi.showErrorAndClose(
this::onMicrotransactionUiErroredAndClosed, R.string.payments_error_message); this::onMinimalUiErroredAndClosed, R.string.payments_error_message);
return; return;
} }
...@@ -2967,9 +2965,9 @@ public class PaymentRequestImpl ...@@ -2967,9 +2965,9 @@ public class PaymentRequestImpl
*/ */
private void closeUIAndDestroyNativeObjects() { private void closeUIAndDestroyNativeObjects() {
ensureHideAndResetPaymentHandlerUi(); ensureHideAndResetPaymentHandlerUi();
if (mMicrotransactionUi != null) { if (mMinimalUi != null) {
mMicrotransactionUi.hide(); mMinimalUi.hide();
mMicrotransactionUi = null; mMinimalUi = null;
} }
if (mUI != null) { if (mUI != null) {
......
...@@ -271,7 +271,7 @@ public class ServiceWorkerPaymentApp extends PaymentApp { ...@@ -271,7 +271,7 @@ public class ServiceWorkerPaymentApp extends PaymentApp {
List<PaymentShippingOption> shippingOptions, InstrumentDetailsCallback callback) { List<PaymentShippingOption> shippingOptions, InstrumentDetailsCallback callback) {
assert mPaymentHandlerHost != null; assert mPaymentHandlerHost != null;
if (mNeedsInstallation) { if (mNeedsInstallation) {
assert !mIsMicrotransaction; assert mCanShowOwnUI;
BitmapDrawable icon = (BitmapDrawable) getDrawableIcon(); BitmapDrawable icon = (BitmapDrawable) getDrawableIcon();
ServiceWorkerPaymentAppBridge.installAndInvokePaymentApp(mWebContents, origin, ServiceWorkerPaymentAppBridge.installAndInvokePaymentApp(mWebContents, origin,
iframeOrigin, id, new HashSet<>(methodData.values()), total, iframeOrigin, id, new HashSet<>(methodData.values()), total,
...@@ -283,7 +283,7 @@ public class ServiceWorkerPaymentApp extends PaymentApp { ...@@ -283,7 +283,7 @@ public class ServiceWorkerPaymentApp extends PaymentApp {
ServiceWorkerPaymentAppBridge.invokePaymentApp(mWebContents, mRegistrationId, ServiceWorkerPaymentAppBridge.invokePaymentApp(mWebContents, mRegistrationId,
mScope.toString(), origin, iframeOrigin, id, new HashSet<>(methodData.values()), mScope.toString(), origin, iframeOrigin, id, new HashSet<>(methodData.values()),
total, new HashSet<>(modifiers.values()), paymentOptions, shippingOptions, total, new HashSet<>(modifiers.values()), paymentOptions, shippingOptions,
mPaymentHandlerHost, mIsMicrotransaction, callback); mPaymentHandlerHost, mCanShowOwnUI, callback);
} }
} }
......
...@@ -325,8 +325,7 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface ...@@ -325,8 +325,7 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface
* @param total The PaymentItem that represents the total cost of the payment. * @param total The PaymentItem that represents the total cost of the payment.
* @param modifiers Payment method specific modifiers to the payment items and the total. * @param modifiers Payment method specific modifiers to the payment items and the total.
* @param host The host of the payment handler. * @param host The host of the payment handler.
* @param isMicrotrans Whether the payment handler should be invoked in the microtransaction * @param canShowOwnUI Whether the payment handler is allowed to show its own UI.
* mode.
* @param callback Called after the payment app is finished running. * @param callback Called after the payment app is finished running.
*/ */
public static void invokePaymentApp(WebContents webContents, long registrationId, public static void invokePaymentApp(WebContents webContents, long registrationId,
...@@ -334,7 +333,7 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface ...@@ -334,7 +333,7 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface
Set<PaymentMethodData> methodData, PaymentItem total, Set<PaymentMethodData> methodData, PaymentItem total,
Set<PaymentDetailsModifier> modifiers, PaymentOptions paymentOptions, Set<PaymentDetailsModifier> modifiers, PaymentOptions paymentOptions,
List<PaymentShippingOption> shippingOptions, PaymentHandlerHost host, List<PaymentShippingOption> shippingOptions, PaymentHandlerHost host,
boolean isMicrotrans, PaymentApp.InstrumentDetailsCallback callback) { boolean canShowOwnUI, PaymentApp.InstrumentDetailsCallback callback) {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
ServiceWorkerPaymentAppBridgeJni.get().invokePaymentApp(webContents, registrationId, ServiceWorkerPaymentAppBridgeJni.get().invokePaymentApp(webContents, registrationId,
...@@ -342,7 +341,7 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface ...@@ -342,7 +341,7 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface
methodData.toArray(new PaymentMethodData[0]), total, methodData.toArray(new PaymentMethodData[0]), total,
modifiers.toArray(new PaymentDetailsModifier[0]), paymentOptions, modifiers.toArray(new PaymentDetailsModifier[0]), paymentOptions,
shippingOptions.toArray(new PaymentShippingOption[0]), shippingOptions.toArray(new PaymentShippingOption[0]),
host.getNativePaymentHandlerHost(), isMicrotrans, callback); host.getNativePaymentHandlerHost(), canShowOwnUI, callback);
} }
/** /**
...@@ -664,7 +663,7 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface ...@@ -664,7 +663,7 @@ public class ServiceWorkerPaymentAppBridge implements PaymentAppFactoryInterface
String paymentRequestId, PaymentMethodData[] methodData, PaymentItem total, String paymentRequestId, PaymentMethodData[] methodData, PaymentItem total,
PaymentDetailsModifier[] modifiers, PaymentOptions paymentOptions, PaymentDetailsModifier[] modifiers, PaymentOptions paymentOptions,
PaymentShippingOption[] shippingOptions, long nativePaymentHandlerObject, PaymentShippingOption[] shippingOptions, long nativePaymentHandlerObject,
boolean isMicrotrans, PaymentApp.InstrumentDetailsCallback callback); boolean canShowOwnUI, PaymentApp.InstrumentDetailsCallback callback);
void installAndInvokePaymentApp(WebContents webContents, String topOrigin, void installAndInvokePaymentApp(WebContents webContents, String topOrigin,
String paymentRequestOrigin, String paymentRequestId, String paymentRequestOrigin, String paymentRequestId,
PaymentMethodData[] methodData, PaymentItem total, PaymentMethodData[] methodData, PaymentItem total,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
package org.chromium.chrome.browser.payments.micro; package org.chromium.chrome.browser.payments.minimal;
import android.content.Context; import android.content.Context;
...@@ -16,56 +16,50 @@ import org.chromium.ui.modelutil.PropertyModel; ...@@ -16,56 +16,50 @@ import org.chromium.ui.modelutil.PropertyModel;
import org.chromium.ui.modelutil.PropertyModelChangeProcessor; import org.chromium.ui.modelutil.PropertyModelChangeProcessor;
/** /**
* Microtransaction coordinator, which owns the component overall, i.e., creates other objects in * Payment minimal UI coordinator, which owns the component overall, i.e., creates other objects in
* the component and connects them. It decouples the implementation of this component from other * the component and connects them. It decouples the implementation of this component from other
* components and acts as the point of contact between them. Any code in this component that needs * components and acts as the point of contact between them. Any code in this component that needs
* to interact with another component does that through this coordinator. * to interact with another component does that through this coordinator.
*/ */
public class MicrotransactionCoordinator { public class MinimalUICoordinator {
private MicrotransactionMediator mMediator; private MinimalUIMediator mMediator;
private Runnable mHider; private Runnable mHider;
/** Observer for microtransaction UI being ready for user input. */ /** Observer for minimal UI being ready for user input. */
public interface ReadyObserver { public interface ReadyObserver {
/** /**
* Called when the microtransaction UI is ready for user input, i.e., fingerprint scan or * Called when the minimal UI is ready for user input, i.e., fingerprint scan or
* click on [Pay] button. * click on [Pay] button.
*/ */
void onReady(); void onReady();
} }
/** Observer for the confirmation of the microtransaction UI. */ /** Observer for the confirmation of the minimal UI. */
public interface ConfirmObserver { public interface ConfirmObserver {
/** /**
* Called after the user has confirmed payment in the microtransaction UI. * Called after the user has confirmed payment in the minimal UI.
* @param app The app to be used for the microtransaction. * @param app The app to be used for the minimal UI.
*/ */
void onConfirmed(PaymentApp app); void onConfirmed(PaymentApp app);
} }
/** Observer for the dismissal of the microtransaction UI. */ /** Observer for the dismissal of the minimal UI. */
public interface DismissObserver { public interface DismissObserver {
/** /**
* Called after the user has dismissed the microtransaction UI by swiping it down or tapping * Called after the user has dismissed the minimal UI by swiping it down or tapping
* on the scrim behind the UI. * on the scrim behind the UI.
*/ */
void onDismissed(); void onDismissed();
} }
/** /** Observer for the closing of the minimal UI after showing the "Payment complete" message. */
* Observer for the closing of the microtransaction UI after showing the "Payment complete"
* message.
*/
public interface CompleteAndCloseObserver { public interface CompleteAndCloseObserver {
/** /** Called after the UI has shown the "Payment complete" message and has closed itself. */
* Called after the UI has shown the "Payment complete" message and has closed itself.
*/
void onCompletedAndClosed(); void onCompletedAndClosed();
} }
/** /**
* Observer for the closing of the microtransaction UI after showing a transaction failure error * Observer for the closing of the minimal UI after showing a transaction failure error message.
* message.
*/ */
public interface ErrorAndCloseObserver { public interface ErrorAndCloseObserver {
/** /**
...@@ -74,53 +68,52 @@ public class MicrotransactionCoordinator { ...@@ -74,53 +68,52 @@ public class MicrotransactionCoordinator {
void onErroredAndClosed(); void onErroredAndClosed();
} }
/** Constructs the microtransaction component coordinator. */ /** Constructs the minimal UI component coordinator. */
public MicrotransactionCoordinator() {} public MinimalUICoordinator() {}
/** /**
* Shows the microtransaction UI. * Shows the minimal UI.
* *
* @param chromeActivity The activity where the UI should be shown. * @param chromeActivity The activity where the UI should be shown.
* @param app The app that contains the details to display and can be invoked * @param app The app that contains the details to display and can be invoked
* upon user confirmation. * upon user confirmation.
* @param formatter Formats the account balance amount according to its currency. * @param formatter Formats the account balance amount according to its currency.
* @param total The total amount and currency for this microtransaction. * @param total The total amount and currency for this payment.
* @param readyObserver The observer to be notified when the UI is ready for user input. * @param readyObserver The observer to be notified when the UI is ready for user input.
* @param confirmObserver The observer to be notified when the user has confirmed the * @param confirmObserver The observer to be notified when the user has confirmed payment.
* microtransaction.
* @param dismissObserver The observer to be notified when the user has dismissed the UI. * @param dismissObserver The observer to be notified when the user has dismissed the UI.
* @return Whether the microtransaction UI was shown. Can be false if the UI was suppressed. * @return Whether the minimal UI was shown. Can be false if the UI was suppressed.
*/ */
public boolean show(Context context, BottomSheetController bottomSheetController, public boolean show(Context context, BottomSheetController bottomSheetController,
PaymentApp app, CurrencyFormatter formatter, LineItem total, PaymentApp app, CurrencyFormatter formatter, LineItem total,
ReadyObserver readyObserver, ConfirmObserver confirmObserver, ReadyObserver readyObserver, ConfirmObserver confirmObserver,
DismissObserver dismissObserver) { DismissObserver dismissObserver) {
assert mMediator == null : "Already showing microtransaction UI"; assert mMediator == null : "Already showing minimal UI";
PropertyModel model = PropertyModel model =
new PropertyModel.Builder(MicrotransactionProperties.ALL_KEYS) new PropertyModel.Builder(MinimalUIProperties.ALL_KEYS)
.with(MicrotransactionProperties.ACCOUNT_BALANCE, .with(MinimalUIProperties.ACCOUNT_BALANCE,
formatter.format(app.accountBalance())) formatter.format(app.accountBalance()))
.with(MicrotransactionProperties.AMOUNT, total.getPrice()) .with(MinimalUIProperties.AMOUNT, total.getPrice())
.with(MicrotransactionProperties.CURRENCY, total.getCurrency()) .with(MinimalUIProperties.CURRENCY, total.getCurrency())
.with(MicrotransactionProperties.IS_PEEK_STATE_ENABLED, true) .with(MinimalUIProperties.IS_PEEK_STATE_ENABLED, true)
.with(MicrotransactionProperties.IS_SHOWING_LINE_ITEMS, true) .with(MinimalUIProperties.IS_SHOWING_LINE_ITEMS, true)
.with(MicrotransactionProperties.IS_SHOWING_PROCESSING_SPINNER, false) .with(MinimalUIProperties.IS_SHOWING_PROCESSING_SPINNER, false)
.with(MicrotransactionProperties.PAYMENT_APP_ICON, app.getDrawableIcon()) .with(MinimalUIProperties.PAYMENT_APP_ICON, app.getDrawableIcon())
.with(MicrotransactionProperties.PAYMENT_APP_NAME, app.getLabel()) .with(MinimalUIProperties.PAYMENT_APP_NAME, app.getLabel())
.build(); .build();
mMediator = new MicrotransactionMediator( mMediator = new MinimalUIMediator(
context, app, model, readyObserver, confirmObserver, dismissObserver, this::hide); context, app, model, readyObserver, confirmObserver, dismissObserver, this::hide);
bottomSheetController.addObserver(mMediator); bottomSheetController.addObserver(mMediator);
MicrotransactionView view = new MicrotransactionView(context); MinimalUIView view = new MinimalUIView(context);
view.mToolbarPayButton.setOnClickListener(mMediator); view.mToolbarPayButton.setOnClickListener(mMediator);
view.mContentPayButton.setOnClickListener(mMediator); view.mContentPayButton.setOnClickListener(mMediator);
PropertyModelChangeProcessor changeProcessor = PropertyModelChangeProcessor changeProcessor =
PropertyModelChangeProcessor.create(model, view, MicrotransactionViewBinder::bind); PropertyModelChangeProcessor.create(model, view, MinimalUIViewBinder::bind);
mHider = () -> { mHider = () -> {
mMediator.hide(); mMediator.hide();
...@@ -132,7 +125,7 @@ public class MicrotransactionCoordinator { ...@@ -132,7 +125,7 @@ public class MicrotransactionCoordinator {
return bottomSheetController.requestShowContent(/*content=*/view, /*animate=*/true); return bottomSheetController.requestShowContent(/*content=*/view, /*animate=*/true);
} }
/** Hides the microtransaction UI. */ /** Hides the minimal UI. */
public void hide() { public void hide() {
mHider.run(); mHider.run();
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
package org.chromium.chrome.browser.payments.micro; package org.chromium.chrome.browser.payments.minimal;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
...@@ -12,8 +12,8 @@ import org.chromium.ui.modelutil.PropertyModel.WritableBooleanPropertyKey; ...@@ -12,8 +12,8 @@ import org.chromium.ui.modelutil.PropertyModel.WritableBooleanPropertyKey;
import org.chromium.ui.modelutil.PropertyModel.WritableFloatPropertyKey; import org.chromium.ui.modelutil.PropertyModel.WritableFloatPropertyKey;
import org.chromium.ui.modelutil.PropertyModel.WritableObjectPropertyKey; import org.chromium.ui.modelutil.PropertyModel.WritableObjectPropertyKey;
/** Microtransaction UI properties, which fully describe the state of the UI. */ /** Payment minimal UI properties, which fully describe the state of the UI. */
/* package */ class MicrotransactionProperties { /* package */ class MinimalUIProperties {
/* package */ static final ReadableObjectPropertyKey<Drawable> PAYMENT_APP_ICON = /* package */ static final ReadableObjectPropertyKey<Drawable> PAYMENT_APP_ICON =
new ReadableObjectPropertyKey<>(); new ReadableObjectPropertyKey<>();
...@@ -66,5 +66,5 @@ import org.chromium.ui.modelutil.PropertyModel.WritableObjectPropertyKey; ...@@ -66,5 +66,5 @@ import org.chromium.ui.modelutil.PropertyModel.WritableObjectPropertyKey;
ACCOUNT_BALANCE, STATUS_TEXT}; ACCOUNT_BALANCE, STATUS_TEXT};
// Prevent instantiation. // Prevent instantiation.
private MicrotransactionProperties() {} private MinimalUIProperties() {}
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
package org.chromium.chrome.browser.payments.micro; package org.chromium.chrome.browser.payments.minimal;
import android.content.Context; import android.content.Context;
import android.view.LayoutInflater; import android.view.LayoutInflater;
...@@ -16,8 +16,8 @@ import androidx.annotation.Nullable; ...@@ -16,8 +16,8 @@ import androidx.annotation.Nullable;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent; import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent;
/** Microtransaction UI. */ /** Payment minimal UI. */
/* package */ class MicrotransactionView implements BottomSheetContent { /* package */ class MinimalUIView implements BottomSheetContent {
private final View mContentView; private final View mContentView;
private final View mToolbarView; private final View mToolbarView;
...@@ -49,12 +49,12 @@ import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent; ...@@ -49,12 +49,12 @@ import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent;
/* package */ boolean mIsPeekStateEnabled; /* package */ boolean mIsPeekStateEnabled;
/* package */ MicrotransactionView(Context context) { /* package */ MinimalUIView(Context context) {
mContext = context; mContext = context;
mContentView = mContentView =
LayoutInflater.from(mContext).inflate(R.layout.microtransaction_content, null); LayoutInflater.from(mContext).inflate(R.layout.payment_minimal_ui_content, null);
mToolbarView = mToolbarView =
LayoutInflater.from(mContext).inflate(R.layout.microtransaction_toolbar, null); LayoutInflater.from(mContext).inflate(R.layout.payment_minimal_ui_toolbar, null);
mContentPayButton = (Button) mContentView.findViewById(R.id.pay_button); mContentPayButton = (Button) mContentView.findViewById(R.id.pay_button);
mToolbarPayButton = (Button) mToolbarView.findViewById(R.id.pay_button); mToolbarPayButton = (Button) mToolbarView.findViewById(R.id.pay_button);
...@@ -107,8 +107,8 @@ import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent; ...@@ -107,8 +107,8 @@ import org.chromium.chrome.browser.widget.bottomsheet.BottomSheetContent;
@Override @Override
@ContentPriority @ContentPriority
public int getPriority() { public int getPriority() {
// If multiple bottom sheets are queued up to be shown, prioritize microtransaction, because // If multiple bottom sheets are queued up to be shown, prioritize payment, because it's
// it's triggered by a user gesture, such as a click on <button>Buy this article</button>. // triggered by a user gesture, such as a click on <button>Buy this article</button>.
return BottomSheetContent.ContentPriority.HIGH; return BottomSheetContent.ContentPriority.HIGH;
} }
......
...@@ -550,7 +550,7 @@ static void JNI_ServiceWorkerPaymentAppBridge_InvokePaymentApp( ...@@ -550,7 +550,7 @@ static void JNI_ServiceWorkerPaymentAppBridge_InvokePaymentApp(
const JavaParamRef<jobject>& jpayment_options, const JavaParamRef<jobject>& jpayment_options,
const JavaParamRef<jobjectArray>& jshipping_options, const JavaParamRef<jobjectArray>& jshipping_options,
jlong payment_handler_host, jlong payment_handler_host,
jboolean is_microtransaction, jboolean can_show_own_ui,
const JavaParamRef<jobject>& jcallback) { const JavaParamRef<jobject>& jcallback) {
content::WebContents* web_contents = content::WebContents* web_contents =
content::WebContents::FromJavaWebContents(jweb_contents); content::WebContents::FromJavaWebContents(jweb_contents);
...@@ -570,7 +570,7 @@ static void JNI_ServiceWorkerPaymentAppBridge_InvokePaymentApp( ...@@ -570,7 +570,7 @@ static void JNI_ServiceWorkerPaymentAppBridge_InvokePaymentApp(
host->set_payment_request_id_for_logs(event_data->payment_request_id); host->set_payment_request_id_for_logs(event_data->payment_request_id);
host->set_registration_id_for_logs(reg_id); host->set_registration_id_for_logs(reg_id);
// TODO(https://crbug.com/1000432): Pass |is_microtransaction| to the service // TODO(https://crbug.com/1000432): Pass |can_show_own_ui| to the service
// worker. // worker.
content::PaymentAppProvider::GetInstance()->InvokePaymentApp( content::PaymentAppProvider::GetInstance()->InvokePaymentApp(
web_contents->GetBrowserContext(), reg_id, sw_scope_origin, web_contents->GetBrowserContext(), reg_id, sw_scope_origin,
......
...@@ -50,7 +50,7 @@ public abstract class ErrorStrings {{ ...@@ -50,7 +50,7 @@ public abstract class ErrorStrings {{
public static final String UNRECOGNIZED_ACTIVITY_RESULT = public static final String UNRECOGNIZED_ACTIVITY_RESULT =
"Payment app returned unrecognized activity result %d."; "Payment app returned unrecognized activity result %d.";
public static final String MICROTRANSACTION_UI_SUPPRESSED = "Microtransaction UI suppressed."; public static final String MINIMAL_UI_SUPPRESSED = "Payment minimal UI suppressed.";
// Prevent instantiation. // Prevent instantiation.
private ErrorStrings() {{}} private ErrorStrings() {{}}
......
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