Chromium Code Reviews| 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 62% |
| 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..9fccddf562ebf5ad1a9d2597c702783022051360 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,21 +50,24 @@ class PaymentRequestDialog : public views::DialogDelegateView { |
| bool ShouldShowCloseButton() const override; |
| int GetDialogButtons() const override; |
| + // payments::PaymentRequestDialog |
| + void ShowDialog() override; |
| + void CloseDialog(bool propagate_to_renderer) override; |
| + |
| void GoBack(); |
| void ShowOrderSummary(); |
| void ShowPaymentMethodSheet(); |
| - void CloseDialog(); |
| - static void ShowWebModalPaymentDialog(PaymentRequestDialog* dialog, |
| - PaymentRequest* request); |
| + // Used for testing. |
| + views::Widget* widget() { return widget_; } |
|
please use gerrit instead
2017/01/23 15:02:08
widget_for_testing()
Mathieu
2017/01/23 20:58:36
Done.
|
| 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 |
| @@ -73,10 +78,15 @@ class PaymentRequestDialog : public views::DialogDelegateView { |
| ObserverForTest* observer_; |
|
please use gerrit instead
2017/01/23 15:02:08
observer_for_testing_ to be consistent? Maybe good
Mathieu
2017/01/23 20:58:36
Done.
|
| ControllerMap controller_map_; |
| ViewStack view_stack_; |
| + // A reference to the widget created when the dialog is shown. |
|
please use gerrit instead
2017/01/23 15:02:08
Add a note that this widget is owned by its parent
Mathieu
2017/01/23 20:58:36
Done.
|
| + views::Widget* widget_; |
|
please use gerrit instead
2017/01/23 15:02:08
widget_for_testing_
Mathieu
2017/01/23 20:58:36
Done.
|
| + // Keeps track of whether this dialog should inform the renderer of its |
| + // closure (through the PaymentRequest reference). |
| + bool propagate_closure_to_renderer_; |
| - DISALLOW_COPY_AND_ASSIGN(PaymentRequestDialog); |
| + 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_ |