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

Unified Diff: chrome/browser/ui/views/payments/view_stack_state.h

Issue 2528503002: [WebPayments] Implement state transitions in desktop WebPayments dialog. (Closed)
Patch Set: Factor out ViewStack and animations Created 4 years 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/ui/views/payments/view_stack_state.h
diff --git a/chrome/browser/ui/views/payments/view_stack_state.h b/chrome/browser/ui/views/payments/view_stack_state.h
new file mode 100644
index 0000000000000000000000000000000000000000..743a1279bfc73c25c5f9273f942e09b903896412
--- /dev/null
+++ b/chrome/browser/ui/views/payments/view_stack_state.h
@@ -0,0 +1,40 @@
+// 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_VIEW_STACK_STATE_H_
+#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_STATE_H_
+
+#include <memory>
+
+#include "base/macros.h"
+
+namespace views {
+class View;
+}
+
+// Base class for the ViewStack states. Each state represents a view that can be
+// added to the ViewStack and animated by it.
+class ViewStackState {
+ public:
+ ViewStackState();
+ virtual ~ViewStackState();
+
+ // Create the view associated with this state if needed and return it. This
+ // object owns the view and has called set_owned_by_client() on it.
+ views::View* GetView();
+
+ protected:
+ // Create the view associated with this state. Subclasses should override this
+ // to create the view they represent. This is called by GetView(), which calls
+ // set_owned_by_client() so CreateView() doesn't have to do anything about the
+ // ownership of the return view.
+ virtual views::View* CreateView() = 0;
+
+ private:
+ std::unique_ptr<views::View> view_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewStackState);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_STATE_H_

Powered by Google App Engine
This is Rietveld 408576698