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

Side by Side Diff: components/mus/view_tree_host_connection.cc

Issue 1377493002: mus: move View Manager to components/mus/vm (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased 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 unified diff | Download patch
« no previous file with comments | « components/mus/view_tree_host_connection.h ('k') | components/mus/view_tree_host_delegate.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 "components/mus/view_tree_host_connection.h"
6
7 #include "components/mus/connection_manager.h"
8 #include "components/mus/view_tree_host_impl.h"
9
10 namespace mus {
11
12 ViewTreeHostConnection::ViewTreeHostConnection(
13 scoped_ptr<ViewTreeHostImpl> host_impl,
14 ConnectionManager* manager)
15 : host_(host_impl.Pass()),
16 tree_(nullptr),
17 connection_manager_(manager),
18 connection_closed_(false) {}
19
20 ViewTreeHostConnection::~ViewTreeHostConnection() {
21 // If this DCHECK fails then something has tried to delete this object without
22 // calling CloseConnection.
23 DCHECK(connection_closed_);
24 }
25
26 void ViewTreeHostConnection::CloseConnection() {
27 // A connection error will trigger the display to close and so we want to make
28 // sure we signal the ConnectionManager only once.
29 if (connection_closed_)
30 return;
31 // We have to shut down the focus system for this host before destroying the
32 // host, as destruction of the view tree will attempt to change focus.
33 host_->DestroyFocusController();
34 connection_manager()->OnHostConnectionClosed(this);
35 connection_closed_ = true;
36 delete this;
37 }
38
39 ViewTreeImpl* ViewTreeHostConnection::GetViewTree() {
40 return tree_;
41 }
42
43 void ViewTreeHostConnection::OnDisplayInitialized() {}
44
45 void ViewTreeHostConnection::OnDisplayClosed() {
46 CloseConnection();
47 }
48
49 ViewTreeHostConnectionImpl::ViewTreeHostConnectionImpl(
50 mojo::InterfaceRequest<mojo::ViewTreeHost> request,
51 scoped_ptr<ViewTreeHostImpl> host_impl,
52 mojo::ViewTreeClientPtr client,
53 ConnectionManager* manager)
54 : ViewTreeHostConnection(host_impl.Pass(), manager),
55 binding_(view_tree_host(), request.Pass()),
56 client_(client.Pass()) {}
57
58 ViewTreeHostConnectionImpl::~ViewTreeHostConnectionImpl() {}
59
60 void ViewTreeHostConnectionImpl::OnDisplayInitialized() {
61 connection_manager()->AddHost(this);
62 set_view_tree(connection_manager()->EmbedAtView(
63 kInvalidConnectionId, view_tree_host()->root_view()->id(),
64 mojo::ViewTree::ACCESS_POLICY_EMBED_ROOT, client_.Pass()));
65 }
66
67 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/view_tree_host_connection.h ('k') | components/mus/view_tree_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698