Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 | |
| 12 namespace views { | |
| 13 class View; | |
| 14 } | |
| 15 | |
| 16 namespace payments { | |
| 17 | |
| 18 class PaymentRequestDialog; | |
| 19 class PaymentRequestImpl; | |
| 20 | |
| 21 // The base class for objects responsible for the creation and event handling in | |
| 22 // views shown in the PaymentRequestDialog. | |
| 23 class PaymentRequestSheetController { | |
| 24 public: | |
| 25 // 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.
| |
| 26 // should be valid throughout this object's lifetime. | |
| 27 // |impl| is also not owned by this and is guaranteed to outlive dialog. | |
| 28 PaymentRequestSheetController(PaymentRequestImpl* impl, | |
| 29 PaymentRequestDialog* dialog) | |
| 30 : impl_(impl), | |
| 31 dialog_(dialog) {} | |
| 32 virtual ~PaymentRequestSheetController() {} | |
| 33 | |
| 34 virtual std::unique_ptr<views::View> CreateView() = 0; | |
| 35 | |
| 36 // The PaymentRequestImpl object associated with this instance of the dialog. | |
| 37 // 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.
| |
| 38 PaymentRequestImpl* impl() { return impl_; } | |
| 39 | |
| 40 // The dialog that contains and owns this object. | |
| 41 // 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.
| |
| 42 PaymentRequestDialog* dialog() { return dialog_; } | |
| 43 | |
| 44 private: | |
| 45 // 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.
| |
| 46 PaymentRequestImpl* impl_; | |
| 47 | |
| 48 // 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.
| |
| 49 PaymentRequestDialog* dialog_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(PaymentRequestSheetController); | |
| 52 }; | |
| 53 | |
| 54 } // namespace payments | |
| 55 | |
| 56 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_SHEET_CONTROLLER_H_ | |
| OLD | NEW |