OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "services/ui/launcher/launch_instance.h" | 5 #include "services/ui/launcher/launch_instance.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 void LaunchInstance::Launch() { | 34 void LaunchInstance::Launch() { |
35 DVLOG(1) << "Launching " << app_url_; | 35 DVLOG(1) << "Launching " << app_url_; |
36 TRACE_EVENT0("launcher", __func__); | 36 TRACE_EVENT0("launcher", __func__); |
37 | 37 |
38 InitViewport(); | 38 InitViewport(); |
39 | 39 |
40 mojo::ui::ViewProviderPtr client_view_provider; | 40 mojo::ui::ViewProviderPtr client_view_provider; |
41 mojo::ConnectToService(app_impl_->shell(), app_url_, | 41 mojo::ConnectToService(app_impl_->shell(), app_url_, |
42 GetProxy(&client_view_provider)); | 42 GetProxy(&client_view_provider)); |
43 | 43 |
44 client_view_provider->CreateView(GetProxy(&client_view_owner_), nullptr, | 44 client_view_provider->CreateView(GetProxy(&client_view_owner_), nullptr); |
45 nullptr); | |
46 } | 45 } |
47 | 46 |
48 void LaunchInstance::InitViewport() { | 47 void LaunchInstance::InitViewport() { |
49 mojo::ConnectToService(app_impl_->shell(), "mojo:native_viewport_service", | 48 mojo::ConnectToService(app_impl_->shell(), "mojo:native_viewport_service", |
50 GetProxy(&viewport_)); | 49 GetProxy(&viewport_)); |
51 viewport_.set_connection_error_handler(base::Bind( | 50 viewport_.set_connection_error_handler(base::Bind( |
52 &LaunchInstance::OnViewportConnectionError, base::Unretained(this))); | 51 &LaunchInstance::OnViewportConnectionError, base::Unretained(this))); |
53 | 52 |
54 mojo::NativeViewportEventDispatcherPtr dispatcher; | 53 mojo::NativeViewportEventDispatcherPtr dispatcher; |
55 viewport_event_dispatcher_binding_.Bind(GetProxy(&dispatcher)); | 54 viewport_event_dispatcher_binding_.Bind(GetProxy(&dispatcher)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 } | 98 } |
100 | 99 |
101 void LaunchInstance::OnEvent(mojo::EventPtr event, | 100 void LaunchInstance::OnEvent(mojo::EventPtr event, |
102 const mojo::Callback<void()>& callback) { | 101 const mojo::Callback<void()>& callback) { |
103 if (view_tree_) | 102 if (view_tree_) |
104 view_tree_->DispatchEvent(event.Pass()); | 103 view_tree_->DispatchEvent(event.Pass()); |
105 callback.Run(); | 104 callback.Run(); |
106 } | 105 } |
107 | 106 |
108 } // namespace launcher | 107 } // namespace launcher |
OLD | NEW |