Index: mojo/services/view_manager/public/cpp/view.h |
diff --git a/mojo/services/view_manager/public/cpp/view.h b/mojo/services/view_manager/public/cpp/view.h |
index 8569616aefb5802e963de67fd02d76887b8d5c9f..3222b330f08bd5dc2de26a09ee5210596ebc68bd 100644 |
--- a/mojo/services/view_manager/public/cpp/view.h |
+++ b/mojo/services/view_manager/public/cpp/view.h |
@@ -34,10 +34,7 @@ struct ViewProperty; |
class View { |
public: |
using Children = std::vector<View*>; |
- |
- // Creates and returns a new View (which is owned by the ViewManager). Views |
- // are initially hidden, use SetVisible(true) to show. |
- static View* Create(ViewManager* view_manager); |
+ using SharedProperties = std::map<std::string, std::vector<uint8_t>>; |
// Destroys this view and all its children. |
void Destroy(); |
@@ -57,9 +54,7 @@ class View { |
// Returns the set of string to bag of byte properties. These properties are |
// shared with the view manager. |
- const std::map<std::string, std::vector<uint8_t>>& shared_properties() const { |
- return properties_; |
- } |
+ const SharedProperties& shared_properties() const { return properties_; } |
// Sets a property. If |data| is null, this property is deleted. |
void SetSharedProperty(const std::string& name, |
const std::vector<uint8_t>* data); |
@@ -103,6 +98,9 @@ class View { |
View* parent() { return parent_; } |
const View* parent() const { return parent_; } |
const Children& children() const { return children_; } |
+ View* GetRoot() { |
+ return const_cast<View*>(const_cast<const View*>(this)->GetRoot()); |
+ } |
const View* GetRoot() const; |
void AddChild(View* child); |
@@ -136,7 +134,7 @@ class View { |
friend class ViewPrivate; |
friend class ViewManagerClientImpl; |
- explicit View(ViewManager* manager); |
+ View(ViewManager* manager, Id id); |
// Called by the public {Set,Get,Clear}Property functions. |
int64 SetLocalPropertyInternal(const void* key, |
@@ -177,7 +175,7 @@ class View { |
bool visible_; |
- std::map<std::string, std::vector<uint8_t>> properties_; |
+ SharedProperties properties_; |
// Drawn state is derived from the visible state and the parent's visible |
// state. This field is only used if the view has no parent (eg it's a root). |