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

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

Issue 1344573002: Mandoline: Rename components/view_manager to components/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/view_manager/view_tree_host_connection.h" 5 #include "components/mus/view_tree_host_connection.h"
6 6
7 #include "components/view_manager/connection_manager.h" 7 #include "components/mus/connection_manager.h"
8 #include "components/view_manager/view_tree_host_impl.h" 8 #include "components/mus/view_tree_host_impl.h"
9 9
10 namespace view_manager { 10 namespace view_manager {
11 11
12 ViewTreeHostConnection::ViewTreeHostConnection( 12 ViewTreeHostConnection::ViewTreeHostConnection(
13 scoped_ptr<ViewTreeHostImpl> host_impl, 13 scoped_ptr<ViewTreeHostImpl> host_impl,
14 ConnectionManager* manager) 14 ConnectionManager* manager)
15 : host_(host_impl.Pass()), 15 : host_(host_impl.Pass()),
16 tree_(nullptr), 16 tree_(nullptr),
17 connection_manager_(manager), 17 connection_manager_(manager),
18 connection_closed_(false) { 18 connection_closed_(false) {}
19 }
20 19
21 ViewTreeHostConnection::~ViewTreeHostConnection() { 20 ViewTreeHostConnection::~ViewTreeHostConnection() {
22 // If this DCHECK fails then something has tried to delete this object without 21 // If this DCHECK fails then something has tried to delete this object without
23 // calling CloseConnection. 22 // calling CloseConnection.
24 DCHECK(connection_closed_); 23 DCHECK(connection_closed_);
25 } 24 }
26 25
27
28 void ViewTreeHostConnection::CloseConnection() { 26 void ViewTreeHostConnection::CloseConnection() {
29 // A connection error will trigger the display to close and so we want to make 27 // A connection error will trigger the display to close and so we want to make
30 // sure we signal the ConnectionManager only once. 28 // sure we signal the ConnectionManager only once.
31 if (connection_closed_) 29 if (connection_closed_)
32 return; 30 return;
33 // We have to shut down the focus system for this host before destroying the 31 // We have to shut down the focus system for this host before destroying the
34 // host, as destruction of the view tree will attempt to change focus. 32 // host, as destruction of the view tree will attempt to change focus.
35 host_->DestroyFocusController(); 33 host_->DestroyFocusController();
36 connection_manager()->OnHostConnectionClosed(this); 34 connection_manager()->OnHostConnectionClosed(this);
37 connection_closed_ = true; 35 connection_closed_ = true;
38 delete this; 36 delete this;
39 } 37 }
40 38
41 ViewTreeImpl* ViewTreeHostConnection::GetViewTree() { 39 ViewTreeImpl* ViewTreeHostConnection::GetViewTree() {
42 return tree_; 40 return tree_;
43 } 41 }
44 42
45 void ViewTreeHostConnection::OnDisplayInitialized() { 43 void ViewTreeHostConnection::OnDisplayInitialized() {}
46 }
47 44
48 void ViewTreeHostConnection::OnDisplayClosed() { 45 void ViewTreeHostConnection::OnDisplayClosed() {
49 CloseConnection(); 46 CloseConnection();
50 } 47 }
51 48
52 ViewTreeHostConnectionImpl::ViewTreeHostConnectionImpl( 49 ViewTreeHostConnectionImpl::ViewTreeHostConnectionImpl(
53 mojo::InterfaceRequest<mojo::ViewTreeHost> request, 50 mojo::InterfaceRequest<mojo::ViewTreeHost> request,
54 scoped_ptr<ViewTreeHostImpl> host_impl, 51 scoped_ptr<ViewTreeHostImpl> host_impl,
55 mojo::ViewTreeClientPtr client, 52 mojo::ViewTreeClientPtr client,
56 ConnectionManager* manager) 53 ConnectionManager* manager)
57 : ViewTreeHostConnection(host_impl.Pass(), manager), 54 : ViewTreeHostConnection(host_impl.Pass(), manager),
58 binding_(view_tree_host(), request.Pass()), 55 binding_(view_tree_host(), request.Pass()),
59 client_(client.Pass()) { 56 client_(client.Pass()) {}
60 }
61 57
62 ViewTreeHostConnectionImpl::~ViewTreeHostConnectionImpl() { 58 ViewTreeHostConnectionImpl::~ViewTreeHostConnectionImpl() {}
63 }
64 59
65 void ViewTreeHostConnectionImpl::OnDisplayInitialized() { 60 void ViewTreeHostConnectionImpl::OnDisplayInitialized() {
66 connection_manager()->AddHost(this); 61 connection_manager()->AddHost(this);
67 set_view_tree(connection_manager()->EmbedAtView( 62 set_view_tree(connection_manager()->EmbedAtView(
68 kInvalidConnectionId, view_tree_host()->root_view()->id(), 63 kInvalidConnectionId, view_tree_host()->root_view()->id(),
69 client_.Pass())); 64 client_.Pass()));
70 } 65 }
71 66
72 } // namespace view_manager 67 } // namespace view_manager
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