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

Side by Side Diff: services/ui/view_manager/view_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, 1 month 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/logging.h"
6 #include "services/ui/view_manager/view_state.h"
7 #include "services/ui/view_manager/view_tree_state.h"
8
9 namespace view_manager {
10
11 ViewState::ViewState(mojo::ui::ViewPtr view, uint32_t view_token_value)
12 : view_(view.Pass()),
13 view_token_value_(view_token_value),
14 tree_(nullptr),
15 parent_(nullptr),
16 key_(0) {
17 DCHECK(view_);
18 }
19
20 ViewState::~ViewState() {}
21
22 void ViewState::SetTree(ViewTreeState* tree, uint32_t key) {
23 DCHECK(tree);
24 DCHECK(!parent_); // must be the root
25 if (tree_ != tree) {
26 SetTreeUnchecked(tree);
27 }
28 key_ = key;
29 }
30
31 void ViewState::SetTreeUnchecked(ViewTreeState* tree) {
32 tree_ = tree;
33 for (auto it = children.begin(); it != children.end(); ++it) {
34 it->second->SetTreeUnchecked(tree);
35 }
36 }
37
38 void ViewState::SetParent(ViewState* parent, uint32_t key) {
39 DCHECK(parent);
40 parent_ = parent;
41 key_ = key;
42 SetTreeUnchecked(parent->tree_);
43 }
44
45 void ViewState::ResetContainer() {
46 parent_ = nullptr;
47 key_ = 0;
48 SetTreeUnchecked(nullptr);
49 }
50
51 void ViewState::GetServiceProvider(
52 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) {}
53
54 } // namespace view_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698