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

Side by Side Diff: services/ui/launcher/launch_instance.cc

Issue 1916233002: Mark ApplicationImpl::ConnectTo{Application,Service}() as deprecated. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
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/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "mojo/application/application_runner_chromium.h" 10 #include "mojo/application/application_runner_chromium.h"
(...skipping 12 matching lines...) Expand all
23 app_url_(app_url), 23 app_url_(app_url),
24 shutdown_callback_(shutdown_callback), 24 shutdown_callback_(shutdown_callback),
25 viewport_event_dispatcher_binding_(this) {} 25 viewport_event_dispatcher_binding_(this) {}
26 26
27 LaunchInstance::~LaunchInstance() {} 27 LaunchInstance::~LaunchInstance() {}
28 28
29 void LaunchInstance::Launch() { 29 void LaunchInstance::Launch() {
30 DVLOG(1) << "Launching " << app_url_; 30 DVLOG(1) << "Launching " << app_url_;
31 TRACE_EVENT0("launcher", __func__); 31 TRACE_EVENT0("launcher", __func__);
32 32
33 app_impl_->ConnectToService("mojo:compositor_service", &compositor_); 33 app_impl_->ConnectToServiceDeprecated("mojo:compositor_service",
34 &compositor_);
34 compositor_.set_connection_error_handler(base::Bind( 35 compositor_.set_connection_error_handler(base::Bind(
35 &LaunchInstance::OnCompositorConnectionError, base::Unretained(this))); 36 &LaunchInstance::OnCompositorConnectionError, base::Unretained(this)));
36 37
37 app_impl_->ConnectToService("mojo:view_manager_service", &view_manager_); 38 app_impl_->ConnectToServiceDeprecated("mojo:view_manager_service",
39 &view_manager_);
38 view_manager_.set_connection_error_handler(base::Bind( 40 view_manager_.set_connection_error_handler(base::Bind(
39 &LaunchInstance::OnViewManagerConnectionError, base::Unretained(this))); 41 &LaunchInstance::OnViewManagerConnectionError, base::Unretained(this)));
40 42
41 InitViewport(); 43 InitViewport();
42 44
43 mojo::ui::ViewProviderPtr client_view_provider; 45 mojo::ui::ViewProviderPtr client_view_provider;
44 app_impl_->ConnectToService(app_url_, &client_view_provider); 46 app_impl_->ConnectToServiceDeprecated(app_url_, &client_view_provider);
45 47
46 client_view_provider->CreateView(mojo::GetProxy(&client_view_owner_), nullptr, 48 client_view_provider->CreateView(mojo::GetProxy(&client_view_owner_), nullptr,
47 nullptr); 49 nullptr);
48 } 50 }
49 51
50 void LaunchInstance::OnCompositorConnectionError() { 52 void LaunchInstance::OnCompositorConnectionError() {
51 LOG(ERROR) << "Exiting due to compositor connection error."; 53 LOG(ERROR) << "Exiting due to compositor connection error.";
52 shutdown_callback_.Run(); 54 shutdown_callback_.Run();
53 } 55 }
54 56
55 void LaunchInstance::OnViewManagerConnectionError() { 57 void LaunchInstance::OnViewManagerConnectionError() {
56 LOG(ERROR) << "Exiting due to view manager connection error."; 58 LOG(ERROR) << "Exiting due to view manager connection error.";
57 shutdown_callback_.Run(); 59 shutdown_callback_.Run();
58 } 60 }
59 61
60 void LaunchInstance::InitViewport() { 62 void LaunchInstance::InitViewport() {
61 app_impl_->ConnectToService("mojo:native_viewport_service", &viewport_); 63 app_impl_->ConnectToServiceDeprecated("mojo:native_viewport_service",
64 &viewport_);
62 viewport_.set_connection_error_handler(base::Bind( 65 viewport_.set_connection_error_handler(base::Bind(
63 &LaunchInstance::OnViewportConnectionError, base::Unretained(this))); 66 &LaunchInstance::OnViewportConnectionError, base::Unretained(this)));
64 67
65 mojo::NativeViewportEventDispatcherPtr dispatcher; 68 mojo::NativeViewportEventDispatcherPtr dispatcher;
66 viewport_event_dispatcher_binding_.Bind(GetProxy(&dispatcher)); 69 viewport_event_dispatcher_binding_.Bind(GetProxy(&dispatcher));
67 viewport_->SetEventDispatcher(dispatcher.Pass()); 70 viewport_->SetEventDispatcher(dispatcher.Pass());
68 71
69 // Match the Nexus 5 aspect ratio initially. 72 // Match the Nexus 5 aspect ratio initially.
70 auto size = mojo::Size::New(); 73 auto size = mojo::Size::New();
71 size->width = 320; 74 size->width = 320;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 113 }
111 114
112 void LaunchInstance::OnEvent(mojo::EventPtr event, 115 void LaunchInstance::OnEvent(mojo::EventPtr event,
113 const mojo::Callback<void()>& callback) { 116 const mojo::Callback<void()>& callback) {
114 if (view_tree_) 117 if (view_tree_)
115 view_tree_->DispatchEvent(event.Pass()); 118 view_tree_->DispatchEvent(event.Pass());
116 callback.Run(); 119 callback.Run();
117 } 120 }
118 121
119 } // namespace launcher 122 } // namespace launcher
OLDNEW
« no previous file with comments | « services/test_service/test_time_service_impl.cc ('k') | services/ui/view_manager/view_associate_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698