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

Side by Side Diff: mojo/services/view_manager/view_manager_init_service_context.cc

Issue 400113005: A new WM bootstrap flow (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 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 "mojo/services/view_manager/view_manager_init_service_context.h"
6
7 #include "base/bind.h"
8 #include "mojo/services/view_manager/root_node_manager.h"
9 #include "mojo/services/view_manager/view_manager_init_service_impl.h"
10
11 namespace mojo {
12 namespace view_manager {
13 namespace service {
14
15 ViewManagerInitServiceContext::ViewManagerInitServiceContext()
16 : is_tree_host_ready_(false) {}
17 ViewManagerInitServiceContext::~ViewManagerInitServiceContext() {}
18
19 void ViewManagerInitServiceContext::AddConnection(
20 ViewManagerInitServiceImpl* connection) {
21 DCHECK(connections_.find(connection) == connections_.end());
22 connections_.insert(connection);
23 }
24
25 void ViewManagerInitServiceContext::RemoveConnection(
26 ViewManagerInitServiceImpl* connection) {
27 DCHECK(connections_.find(connection) != connections_.end());
28 connections_.erase(connection);
29 }
30
31 void ViewManagerInitServiceContext::ConfigureIncomingConnection(
32 ApplicationConnection* connection) {
33 if (!root_node_manager_.get()) {
34 root_node_manager_.reset(new RootNodeManager(
35 connection,
36 this,
37 base::Bind(&ViewManagerInitServiceContext::OnNativeViewportDeleted,
38 base::Unretained(this))));
39 }
40 }
41
42 void ViewManagerInitServiceContext::OnNativeViewportDeleted() {
43 for (Connections::const_iterator it = connections_.begin();
44 it != connections_.end(); ++it) {
45 (*it)->OnNativeViewportDeleted();
46 }
47 }
48
49 void ViewManagerInitServiceContext::OnRootViewManagerWindowTreeHostCreated() {
50 DCHECK(!is_tree_host_ready_);
51 is_tree_host_ready_ = true;
52 for (Connections::const_iterator it = connections_.begin();
53 it != connections_.end(); ++it) {
54 (*it)->OnRootViewManagerWindowTreeHostCreated();
sky 2014/07/24 16:43:28 The ordering here feels very fragile. In so far as
55 }
56 }
57
58 } // namespace service
59 } // namespace view_manager
60 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698