OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_UI_WEBUI_WUG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_WUG_VIEW_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_WUG_VIEW_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_WUG_VIEW_H_ |
7 | 7 |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 virtual void OnReady(); | 64 virtual void OnReady(); |
65 | 65 |
66 // Forwards context changes stored in |diff| to view-model. | 66 // Forwards context changes stored in |diff| to view-model. |
67 void UpdateContext(const base::DictionaryValue& diff); | 67 void UpdateContext(const base::DictionaryValue& diff); |
68 | 68 |
69 // Forwards |event| to view-model. | 69 // Forwards |event| to view-model. |
70 void HandleEvent(const std::string& event); | 70 void HandleEvent(const std::string& event); |
71 | 71 |
72 bool ready() const { return ready_; } | 72 bool ready() const { return ready_; } |
73 | 73 |
74 base::ScopedPtrHashMap<std::string, View>& children() { return children_; } | 74 base::ScopedPtrHashMap<std::string, scoped_ptr<View>>& children() { |
| 75 return children_; |
| 76 } |
75 | 77 |
76 // Adds |child| to the list of children of |this|. Can be called only from | 78 // Adds |child| to the list of children of |this|. Can be called only from |
77 // CreateAndAddChildren() override. | 79 // CreateAndAddChildren() override. |
78 void AddChild(View* child); | 80 void AddChild(View* child); |
79 | 81 |
80 virtual std::string GetType() = 0; | 82 virtual std::string GetType() = 0; |
81 | 83 |
82 // Implementation should create an instance of view-model for this view. | 84 // Implementation should create an instance of view-model for this view. |
83 virtual ViewModel* CreateViewModel() = 0; | 85 virtual ViewModel* CreateViewModel() = 0; |
84 | 86 |
(...skipping 12 matching lines...) Expand all Loading... |
97 | 99 |
98 View* parent_; | 100 View* parent_; |
99 std::string id_; | 101 std::string id_; |
100 std::string path_; | 102 std::string path_; |
101 | 103 |
102 // Number of child views that are ready. | 104 // Number of child views that are ready. |
103 int ready_children_; | 105 int ready_children_; |
104 | 106 |
105 bool view_model_ready_; | 107 bool view_model_ready_; |
106 bool ready_; | 108 bool ready_; |
107 base::ScopedPtrHashMap<std::string, View> children_; | 109 base::ScopedPtrHashMap<std::string, scoped_ptr<View>> children_; |
108 scoped_ptr<ViewModel> view_model_; | 110 scoped_ptr<ViewModel> view_model_; |
109 base::WeakPtrFactory<View> weak_factory_; | 111 base::WeakPtrFactory<View> weak_factory_; |
110 | 112 |
111 DISALLOW_COPY_AND_ASSIGN(View); | 113 DISALLOW_COPY_AND_ASSIGN(View); |
112 }; | 114 }; |
113 | 115 |
114 } // namespace webui_generator | 116 } // namespace webui_generator |
115 | 117 |
116 #endif // CHROME_BROWSER_UI_WEBUI_WUG_VIEW_H_ | 118 #endif // CHROME_BROWSER_UI_WEBUI_WUG_VIEW_H_ |
OLD | NEW |