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

Unified Diff: chrome/browser/payments/ui/payment_dialog_state.h

Issue 2528503002: [WebPayments] Implement state transitions in desktop WebPayments dialog. (Closed)
Patch Set: Change ToggleInteractable to SetInteractable Created 4 years, 1 month 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/payments/ui/payment_dialog_state.h
diff --git a/chrome/browser/payments/ui/payment_dialog_state.h b/chrome/browser/payments/ui/payment_dialog_state.h
new file mode 100644
index 0000000000000000000000000000000000000000..b1b7a2cba1016fb0ce2c9f0900d20cbda5157817
--- /dev/null
+++ b/chrome/browser/payments/ui/payment_dialog_state.h
@@ -0,0 +1,43 @@
+// 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_PAYMENTS_UI_PAYMENT_DIALOG_STATE_H_
+#define CHROME_BROWSER_PAYMENTS_UI_PAYMENT_DIALOG_STATE_H_
+
+#include "base/macros.h"
+
+namespace views {
+class View;
+}
+
+namespace payments {
+
+// Base class for the different WebPayments UI states.
+class PaymentDialogState {
+ public:
+ // Create the view associated with this state if needed and return it.
+ virtual views::View* GetView() = 0;
please use gerrit instead 2016/11/22 21:39:33 Specify who owns the returned view.
anthonyvd 2016/11/22 22:11:19 Done.
+
+ // Marks the state as interactable or not depending on |interactable|. States
+ // should be marked as non-interactable when they are being transitioned out
+ // or have another state being transitioned in on top of them. A non-
+ // interactable state shouldn't trigger events at all. This is to prevent non-
+ // foreground states from being interacted with.
+ void SetInteractable(bool interactable) {
+ interactable_ = interactable;
+ }
+
+ bool interactable() { return interactable_; }
+
+ protected:
+ PaymentDialogState() {}
please use gerrit instead 2016/11/22 21:39:32 Rule of thumb is that a constructor should always
anthonyvd 2016/11/22 22:11:19 Done. Moved to public to satisfy unique_ptr templa
+
+ private:
+ bool interactable_;
+ DISALLOW_COPY_AND_ASSIGN(PaymentDialogState);
+};
+
+} // namespace payments
+
+#endif // CHROME_BROWSER_PAYMENTS_UI_PAYMENT_DIALOG_STATE_H_

Powered by Google App Engine
This is Rietveld 408576698