OLD | NEW |
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_impl.h" | 5 #include "components/mus/view_tree_host_impl.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "components/view_manager/connection_manager.h" | 8 #include "components/mus/connection_manager.h" |
9 #include "components/view_manager/display_manager.h" | 9 #include "components/mus/display_manager.h" |
10 #include "components/view_manager/focus_controller.h" | 10 #include "components/mus/focus_controller.h" |
11 #include "components/view_manager/public/cpp/types.h" | 11 #include "components/mus/public/cpp/types.h" |
12 #include "components/view_manager/view_tree_host_delegate.h" | 12 #include "components/mus/view_tree_host_delegate.h" |
13 #include "components/view_manager/view_tree_impl.h" | 13 #include "components/mus/view_tree_impl.h" |
14 #include "mojo/common/common_type_converters.h" | 14 #include "mojo/common/common_type_converters.h" |
15 #include "mojo/converters/geometry/geometry_type_converters.h" | 15 #include "mojo/converters/geometry/geometry_type_converters.h" |
16 | 16 |
17 namespace view_manager { | 17 namespace view_manager { |
18 | 18 |
19 ViewTreeHostImpl::ViewTreeHostImpl( | 19 ViewTreeHostImpl::ViewTreeHostImpl( |
20 mojo::ViewTreeHostClientPtr client, | 20 mojo::ViewTreeHostClientPtr client, |
21 ConnectionManager* connection_manager, | 21 ConnectionManager* connection_manager, |
22 bool is_headless, | 22 bool is_headless, |
23 mojo::ApplicationImpl* app_impl, | 23 mojo::ApplicationImpl* app_impl, |
24 const scoped_refptr<gles2::GpuState>& gpu_state, | 24 const scoped_refptr<gles2::GpuState>& gpu_state, |
25 const scoped_refptr<surfaces::SurfacesState>& surfaces_state) | 25 const scoped_refptr<surfaces::SurfacesState>& surfaces_state) |
26 : delegate_(nullptr), | 26 : delegate_(nullptr), |
27 connection_manager_(connection_manager), | 27 connection_manager_(connection_manager), |
28 client_(client.Pass()), | 28 client_(client.Pass()), |
29 event_dispatcher_(this), | 29 event_dispatcher_(this), |
30 display_manager_( | 30 display_manager_(DisplayManager::Create(is_headless, |
31 DisplayManager::Create(is_headless, | 31 app_impl, |
32 app_impl, | 32 gpu_state, |
33 gpu_state, | 33 surfaces_state)), |
34 surfaces_state)), | |
35 focus_controller_(new FocusController(this)) { | 34 focus_controller_(new FocusController(this)) { |
36 display_manager_->Init(this); | 35 display_manager_->Init(this); |
37 if (client_) { | 36 if (client_) { |
38 client_.set_connection_error_handler( | 37 client_.set_connection_error_handler( |
39 base::Bind(&ViewTreeHostImpl::OnClientClosed, | 38 base::Bind(&ViewTreeHostImpl::OnClientClosed, base::Unretained(this))); |
40 base::Unretained(this))); | |
41 } | 39 } |
42 } | 40 } |
43 | 41 |
44 ViewTreeHostImpl::~ViewTreeHostImpl() { | 42 ViewTreeHostImpl::~ViewTreeHostImpl() {} |
45 } | |
46 | 43 |
47 void ViewTreeHostImpl::Init(ViewTreeHostDelegate* delegate) { | 44 void ViewTreeHostImpl::Init(ViewTreeHostDelegate* delegate) { |
48 delegate_ = delegate; | 45 delegate_ = delegate; |
49 if (delegate_ && root_) | 46 if (delegate_ && root_) |
50 delegate_->OnDisplayInitialized(); | 47 delegate_->OnDisplayInitialized(); |
51 } | 48 } |
52 | 49 |
53 ViewTreeImpl* ViewTreeHostImpl::GetViewTree() { | 50 ViewTreeImpl* ViewTreeHostImpl::GetViewTree() { |
54 return delegate_ ? delegate_->GetViewTree() : nullptr; | 51 return delegate_ ? delegate_->GetViewTree() : nullptr; |
55 } | 52 } |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 root_tree != embedded_connection_old && | 232 root_tree != embedded_connection_old && |
236 root_tree != owning_connection_new && | 233 root_tree != owning_connection_new && |
237 root_tree != embedded_connection_new) { | 234 root_tree != embedded_connection_new) { |
238 root_tree->ProcessFocusChanged(old_focused_view, new_focused_view); | 235 root_tree->ProcessFocusChanged(old_focused_view, new_focused_view); |
239 } | 236 } |
240 | 237 |
241 UpdateTextInputState(new_focused_view, new_focused_view->text_input_state()); | 238 UpdateTextInputState(new_focused_view, new_focused_view->text_input_state()); |
242 } | 239 } |
243 | 240 |
244 } // namespace view_manager | 241 } // namespace view_manager |
OLD | NEW |