| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_STUB_H_ | 5 #ifndef SERVICES_UI_VIEW_MANAGER_VIEW_STUB_H_ |
| 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_STUB_H_ | 6 #define SERVICES_UI_VIEW_MANAGER_VIEW_STUB_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 ViewState* state() const { return state_; } | 43 ViewState* state() const { return state_; } |
| 44 | 44 |
| 45 // Returns true if the view which was intended to be referenced by the | 45 // Returns true if the view which was intended to be referenced by the |
| 46 // stub has become unavailable. | 46 // stub has become unavailable. |
| 47 bool is_unavailable() const { return unavailable_; } | 47 bool is_unavailable() const { return unavailable_; } |
| 48 | 48 |
| 49 // Returns true if awaiting resolution of the view. | 49 // Returns true if awaiting resolution of the view. |
| 50 bool is_pending() const { return !state_ && !unavailable_; } | 50 bool is_pending() const { return !state_ && !unavailable_; } |
| 51 | 51 |
| 52 // Returns true if the view is linked into a tree or parent. | 52 // Returns true if the view is linked into a tree or parent. |
| 53 bool is_linked() const { return tree_ && parent_; } | 53 bool is_linked() const { return tree_ || parent_; } |
| 54 |
| 55 // Returns true if the view is linked into a tree and has no parent. |
| 56 bool is_root_of_tree() const { return tree_ && !parent_; } |
| 54 | 57 |
| 55 // Gets the view tree to which this view belongs, or null if none. | 58 // Gets the view tree to which this view belongs, or null if none. |
| 56 ViewTreeState* tree() const { return tree_; } | 59 ViewTreeState* tree() const { return tree_; } |
| 57 | 60 |
| 58 // Gets the parent view state, or null if none. | 61 // Gets the parent view state, or null if none. |
| 59 ViewState* parent() const { return parent_; } | 62 ViewState* parent() const { return parent_; } |
| 60 | 63 |
| 61 // Gets the key that this child has in its container, or 0 if none. | 64 // Gets the key that this child has in its container, or 0 if none. |
| 62 uint32_t key() const { return key_; } | 65 uint32_t key() const { return key_; } |
| 63 | 66 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 ViewTreeState* tree_ = nullptr; | 105 ViewTreeState* tree_ = nullptr; |
| 103 ViewState* parent_ = nullptr; | 106 ViewState* parent_ = nullptr; |
| 104 uint32_t key_ = 0u; | 107 uint32_t key_ = 0u; |
| 105 | 108 |
| 106 DISALLOW_COPY_AND_ASSIGN(ViewStub); | 109 DISALLOW_COPY_AND_ASSIGN(ViewStub); |
| 107 }; | 110 }; |
| 108 | 111 |
| 109 } // namespace view_manager | 112 } // namespace view_manager |
| 110 | 113 |
| 111 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_STUB_H_ | 114 #endif // SERVICES_UI_VIEW_MANAGER_VIEW_STUB_H_ |
| OLD | NEW |