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

Unified Diff: chrome/browser/ui/views/payments/payment_request_dialog_view.h

Issue 2649683002: [Payments] Improve the closing of the PR dialog. (Closed)
Patch Set: addressed comments from sky Created 3 years, 11 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/browser/ui/views/payments/payment_request_dialog_view.h
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog.h b/chrome/browser/ui/views/payments/payment_request_dialog_view.h
similarity index 69%
rename from chrome/browser/ui/views/payments/payment_request_dialog.h
rename to chrome/browser/ui/views/payments/payment_request_dialog_view.h
index e4f2ed16c6a0e88fd48166b4f3d95aee8a2e8f13..4dc0795081a7708bb6fca67ba1d88a176af08da0 100644
--- a/chrome/browser/ui/views/payments/payment_request_dialog.h
+++ b/chrome/browser/ui/views/payments/payment_request_dialog_view.h
@@ -2,14 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
-#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
+#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_
+#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_
#include <map>
#include <memory>
#include "base/macros.h"
#include "chrome/browser/ui/views/payments/view_stack.h"
+#include "components/payments/payment_request_dialog.h"
#include "ui/views/window/dialog_delegate.h"
namespace payments {
@@ -17,16 +18,17 @@ namespace payments {
class PaymentRequest;
class PaymentRequestSheetController;
-// Maps views owned by PaymentRequestDialog::view_stack_ to their controller.
-// PaymentRequestDialog is responsible for listening for those views being
-// removed from the hierarchy and delete the associated controllers.
+// Maps views owned by PaymentRequestDialogView::view_stack_ to their
+// controller. PaymentRequestDialogView is responsible for listening for those
+// views being removed from the hierarchy and delete the associated controllers.
using ControllerMap =
std::map<views::View*, std::unique_ptr<PaymentRequestSheetController>>;
// The dialog delegate that represents a desktop WebPayments dialog. This class
// is responsible for displaying the view associated with the current state of
// the WebPayments flow and managing the transition between those states.
-class PaymentRequestDialog : public views::DialogDelegateView {
+class PaymentRequestDialogView : public views::DialogDelegateView,
+ public PaymentRequestDialog {
public:
class ObserverForTest {
public:
@@ -36,9 +38,9 @@ class PaymentRequestDialog : public views::DialogDelegateView {
// Build a Dialog around the PaymentRequest object. |observer| is used to
// be notified of dialog events as they happen (but may be NULL) and should
// outlive this object.
- PaymentRequestDialog(PaymentRequest* request,
- PaymentRequestDialog::ObserverForTest* observer);
- ~PaymentRequestDialog() override;
+ PaymentRequestDialogView(PaymentRequest* request,
+ PaymentRequestDialogView::ObserverForTest* observer);
+ ~PaymentRequestDialogView() override;
// views::WidgetDelegate
ui::ModalType GetModalType() const override;
@@ -48,35 +50,36 @@ class PaymentRequestDialog : public views::DialogDelegateView {
bool ShouldShowCloseButton() const override;
int GetDialogButtons() const override;
+ // payments::PaymentRequestDialog
+ void ShowDialog() override;
+ void CloseDialog() override;
+
void GoBack();
void ShowOrderSummary();
void ShowPaymentMethodSheet();
- void CloseDialog();
-
- static void ShowWebModalPaymentDialog(PaymentRequestDialog* dialog,
- PaymentRequest* request);
private:
void ShowInitialPaymentSheet();
// views::View
gfx::Size GetPreferredSize() const override;
- void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details)
- override;
+ void ViewHierarchyChanged(
+ const ViewHierarchyChangedDetails& details) override;
// Non-owned reference to the PaymentRequest that initiated this dialog. Since
// the PaymentRequest object always outlives this one, the pointer should
// always be valid even though there is no direct ownership relationship
// between the two.
PaymentRequest* request_;
- // May be null.
- ObserverForTest* observer_;
ControllerMap controller_map_;
ViewStack view_stack_;
- DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog);
+ // May be null.
+ ObserverForTest* observer_for_testing_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialogView);
};
} // namespace payments
-#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
+#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_VIEW_H_

Powered by Google App Engine
This is Rietveld 408576698