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

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
« no previous file with comments | « services/ui/view_manager/view_state.h ('k') | services/ui/view_manager/view_tree_host_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 weak_factory_(this) {
18 DCHECK(view_);
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 (const auto& pair : children_) {
35 pair.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
« no previous file with comments | « services/ui/view_manager/view_state.h ('k') | services/ui/view_manager/view_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698