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_VIEW_STACK_STATE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_STATE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 |
| 12 namespace views { |
| 13 class View; |
| 14 } |
| 15 |
| 16 // Base class for the ViewStack states. Each state represents a view that can be |
| 17 // added to the ViewStack and animated by it. |
| 18 class ViewStackState { |
| 19 public: |
| 20 ViewStackState(); |
| 21 virtual ~ViewStackState(); |
| 22 |
| 23 // Create the view associated with this state if needed and return it. This |
| 24 // object owns the view and has called set_owned_by_client() on it. |
| 25 views::View* GetView(); |
| 26 |
| 27 protected: |
| 28 // Create the view associated with this state. Subclasses should override this |
| 29 // to create the view they represent. This is called by GetView(), which calls |
| 30 // set_owned_by_client() so CreateView() doesn't have to do anything about the |
| 31 // ownership of the return view. |
| 32 virtual views::View* CreateView() = 0; |
| 33 |
| 34 private: |
| 35 std::unique_ptr<views::View> view_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(ViewStackState); |
| 38 }; |
| 39 |
| 40 #endif // CHROME_BROWSER_UI_VIEWS_PAYMENTS_VIEW_STACK_STATE_H_ |
OLD | NEW |