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

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: 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 : provide_size(false),
13 view_(view.Pass()),
14 view_token_value_(view_token_value),
15 tree_(nullptr),
16 parent_(nullptr),
17 key_(0) {
18 DCHECK(view_.get());
19 }
20
21 ViewState::~ViewState() {}
22
23 void ViewState::SetTree(ViewTreeState* tree, uint32_t key) {
24 DCHECK(tree);
25 DCHECK(!parent_); // must be the root
26 if (tree_ != tree) {
27 SetTreeUnchecked(tree);
28 }
29 key_ = key;
30 }
31
32 void ViewState::SetTreeUnchecked(ViewTreeState* tree) {
33 tree_ = tree;
34 for (auto it = children.begin(); it != children.end(); ++it) {
35 it->second->SetTreeUnchecked(tree);
36 }
37 }
38
39 void ViewState::SetParent(ViewState* parent, uint32_t key) {
40 DCHECK(parent);
41 parent_ = parent;
42 key_ = key;
43 SetTreeUnchecked(parent->tree_);
44 }
45
46 void ViewState::ResetContainer() {
47 parent_ = nullptr;
48 key_ = 0;
49 SetTreeUnchecked(nullptr);
50 }
51
52 void ViewState::GetServiceProvider(
53 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider) {}
54
55 } // namespace view_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698