Index: chrome/browser/ui/views/payments/payment_request_sheet_controller.h |
diff --git a/chrome/browser/ui/views/payments/payment_request_sheet_controller.h b/chrome/browser/ui/views/payments/payment_request_sheet_controller.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..1a1bcd2575155b56b2f84ddec5dad193c2b093f7 |
--- /dev/null |
+++ b/chrome/browser/ui/views/payments/payment_request_sheet_controller.h |
@@ -0,0 +1,56 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// 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_SHEET_CONTROLLER_H_ |
+#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ |
+ |
+#include <memory> |
+ |
+#include "base/macros.h" |
+ |
+namespace views { |
+class View; |
+} |
+ |
+namespace payments { |
+ |
+class PaymentRequestDialog; |
+class PaymentRequestImpl; |
+ |
+// The base class for objects responsible for the creation and event handling in |
+// views shown in the PaymentRequestDialog. |
+class PaymentRequestSheetController { |
+ public: |
+ // Objects of this class are owned by |dialog|, so it's a weak pointer that |
please use gerrit instead
2016/12/15 20:29:33
s/weak pointer/non-owned pointer/
This avoids con
anthonyvd
2016/12/15 20:58:08
Good point, done.
|
+ // should be valid throughout this object's lifetime. |
+ // |impl| is also not owned by this and is guaranteed to outlive dialog. |
+ PaymentRequestSheetController(PaymentRequestImpl* impl, |
+ PaymentRequestDialog* dialog) |
+ : impl_(impl), |
+ dialog_(dialog) {} |
+ virtual ~PaymentRequestSheetController() {} |
+ |
+ virtual std::unique_ptr<views::View> CreateView() = 0; |
+ |
+ // The PaymentRequestImpl object associated with this instance of the dialog. |
+ // The pointer is owned by PaymentRequestFactory and will outlive this object. |
please use gerrit instead
2016/12/15 20:29:33
All ownership comments should be from the point of
anthonyvd
2016/12/15 20:58:09
Done, see meta comment for some discussion.
|
+ PaymentRequestImpl* impl() { return impl_; } |
+ |
+ // The dialog that contains and owns this object. |
+ // The return value is owned by its parent view. |
please use gerrit instead
2016/12/15 20:29:33
Ditto
anthonyvd
2016/12/15 20:58:08
Done.
|
+ PaymentRequestDialog* dialog() { return dialog_; } |
+ |
+ private: |
+ // Owned by PaymentRequestFactory and will outlive this object. |
please use gerrit instead
2016/12/15 20:29:33
Let's restrict the private member variable comment
anthonyvd
2016/12/15 20:58:09
Done.
|
+ PaymentRequestImpl* impl_; |
+ |
+ // Owned by its parent view. |
please use gerrit instead
2016/12/15 20:29:33
// Not owned. Will outlive this.
Is that correct
anthonyvd
2016/12/15 20:58:08
It is. Done.
|
+ PaymentRequestDialog* dialog_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); |
+}; |
+ |
+} // namespace payments |
+ |
+#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ |