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

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

Issue 2579513002: [WebPayments] Factor out sheet-specific logic in Controllers. (Closed)
Patch Set: Address comments. Created 4 years 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.h
diff --git a/chrome/browser/ui/views/payments/payment_request_dialog.h b/chrome/browser/ui/views/payments/payment_request_dialog.h
index 2bbc77dd8fbaa747849a27b55f993b86e1858de0..85fbf128358e42e5f0e9d28074d671ac4b7034df 100644
--- a/chrome/browser/ui/views/payments/payment_request_dialog.h
+++ b/chrome/browser/ui/views/payments/payment_request_dialog.h
@@ -5,8 +5,11 @@
#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_DIALOG_H_
+#include <map>
+#include <memory>
+
+#include "base/macros.h"
#include "chrome/browser/ui/views/payments/view_stack.h"
-#include "ui/views/controls/button/button.h"
#include "ui/views/window/dialog_delegate.h"
class ViewStack;
@@ -14,12 +17,18 @@ class ViewStack;
namespace payments {
class PaymentRequestImpl;
+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.
+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,
- public views::ButtonListener {
+class PaymentRequestDialog : public views::DialogDelegateView {
public:
explicit PaymentRequestDialog(PaymentRequestImpl* impl);
~PaymentRequestDialog() override;
@@ -27,25 +36,26 @@ class PaymentRequestDialog : public views::DialogDelegateView,
// views::WidgetDelegate
ui::ModalType GetModalType() const override;
- // views::View
- gfx::Size GetPreferredSize() const override;
-
// views::DialogDelegate
bool Cancel() override;
+ void GoBack();
+ void ShowOrderSummary();
+
private:
void ShowInitialPaymentSheet();
- void ShowOrderSummary();
- void GoBack();
- // views::ButtonListener:
- void ButtonPressed(views::Button* sender, const ui::Event& event) override;
+ // views::View
+ gfx::Size GetPreferredSize() const override;
+ void ViewHierarchyChanged(const ViewHierarchyChangedDetails& details)
+ override;
// Non-owned reference to the PaymentRequestImpl that initiated this dialog.
// Since the PaymentRequestImpl object always outlives this one, the pointer
// should always be valid even though there is no direct ownership
// relationship between the two.
PaymentRequestImpl* impl_;
+ ControllerMap controller_map_;
ViewStack view_stack_;
DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog);

Powered by Google App Engine
This is Rietveld 408576698