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_ |