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_DIALOG_STATE_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_DIALOG_STATE_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 // Base class for the different WebPayments UI states. | |
| 19 class PaymentDialogState { | |
| 20 public: | |
| 21 PaymentDialogState(); | |
| 22 ~PaymentDialogState(); | |
| 23 | |
| 24 // Create the view associated with this state if needed and return it. This | |
| 25 // object owns the view and has called set_owned_by_client() on it. | |
| 26 views::View* GetView(); | |
| 27 | |
| 28 // Marks the state as interactable or not depending on |interactable|. States | |
|
sky
2016/12/08 03:58:17
This seems error prone, and a very weird interface
anthonyvd
2016/12/08 20:31:22
I didn't know about CanProcessEventsWithinSubtree(
| |
| 29 // should be marked as non-interactable when they are being transitioned out | |
| 30 // or have another state being transitioned in on top of them. A non- | |
| 31 // interactable state shouldn't trigger events at all. This is to prevent non- | |
| 32 // foreground states from being interacted with. | |
| 33 void SetInteractable(bool interactable) { | |
| 34 interactable_ = interactable; | |
| 35 } | |
| 36 | |
| 37 bool interactable() { return interactable_; } | |
| 38 | |
| 39 protected: | |
| 40 // Create the view associated with this state. Subclasses should override this | |
| 41 // to create the view they represent. This is called by GetView(), which calls | |
| 42 // set_owned_by_client() so CreateView() doesn't have to do anything about the | |
| 43 // ownership of the return view. | |
| 44 virtual views::View* CreateView() = 0; | |
| 45 | |
| 46 private: | |
| 47 bool interactable_; | |
| 48 std::unique_ptr<views::View> view_; | |
| 49 | |
| 50 DISALLOW_COPY_AND_ASSIGN(PaymentDialogState); | |
| 51 }; | |
| 52 | |
| 53 } // namespace payments | |
| 54 | |
| 55 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_DIALOG_STATE_H_ | |
| OLD | NEW |