Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(436)

Unified Diff: services/ui/view_manager/view_tree_state.cc

Issue 1415493003: mozart: Initial commit of the view manager. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: applied review comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/ui/view_manager/view_tree_state.cc
diff --git a/services/ui/view_manager/view_tree_state.cc b/services/ui/view_manager/view_tree_state.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ed8049f9a87f2102fe80973ea1c4d0e7eea17bfa
--- /dev/null
+++ b/services/ui/view_manager/view_tree_state.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 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.
+
+#include "base/logging.h"
+#include "services/ui/view_manager/view_tree_state.h"
+
+namespace view_manager {
+
+ViewTreeState::ViewTreeState(mojo::ui::ViewTreePtr view_tree)
+ : root_was_set(false),
+ layout_request_pending(false),
+ layout_request_issued(false),
+ view_tree_(view_tree.Pass()),
+ root_(nullptr) {
+ DCHECK(view_tree_);
+}
+
+ViewTreeState::~ViewTreeState() {}
+
+void ViewTreeState::SetRoot(ViewState* root, uint32_t key) {
+ DCHECK(root);
+ if (root_ != root) {
+ ResetRoot();
+ root->SetTree(this, key);
+ root_ = root;
+ }
+}
+
+void ViewTreeState::ResetRoot() {
+ if (root_) {
+ root_->ResetContainer();
+ }
+ root_ = nullptr;
+}
+
+} // namespace view_manager
« services/ui/view_manager/view_tree_state.h ('K') | « services/ui/view_manager/view_tree_state.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698