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

Unified Diff: services/ui/launcher/launch_instance.cc

Issue 1949233002: Create a RegisterViewAssociate method in ViewManager (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Moved launching/registering of view associates to launcher 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/launcher/launch_instance.cc
diff --git a/services/ui/launcher/launch_instance.cc b/services/ui/launcher/launch_instance.cc
index c2aa2cbf26146038d47dec8fd4d115f81db39e97..cf67635d0cbe00d62beec1419ff3b1e6a588e081 100644
--- a/services/ui/launcher/launch_instance.cc
+++ b/services/ui/launcher/launch_instance.cc
@@ -40,6 +40,24 @@ void LaunchInstance::Launch() {
view_manager_.set_connection_error_handler(base::Bind(
&LaunchInstance::OnViewManagerConnectionError, base::Unretained(this)));
+ /// Connect to ViewAssociates.
+ // TODO(mikejurka): get this from the commandline?
+ std::vector<std::string> associate_urls; /// = command_line->GetArgs();
+ if (associate_urls.empty()) {
+ // TODO(jeffbrown): Replace this hardcoded list.
+ associate_urls.push_back("mojo:input_manager_service");
+ }
+
+ for (const auto& url : associate_urls) {
+ DVLOG(2) << "Connecting to ViewAssociate " << url;
+ // Connect to the ViewAssociate.
+ mojo::ui::ViewAssociatePtr associate;
+ mojo::ConnectToService(app_impl_->shell(), url, GetProxy(&associate));
+
+ // Wire up the associate to the ViewManager.
+ view_manager_->RegisterViewAssociate(associate.Pass(), url);
+ }
+
InitViewport();
mojo::ui::ViewProviderPtr client_view_provider;
@@ -50,6 +68,15 @@ void LaunchInstance::Launch() {
nullptr);
}
+void LaunchInstance::OnViewAssociateConnectionError(
+ const mojo::String& label,
+ const OnViewAssociateConnectionErrorCallback& callback) {
+ LOG(ERROR) << "Exiting due to view associate connection error.";
+ // TODO(mikejurka): should we even be running this callback?
jeffbrown 2016/05/17 00:44:49 yes, all callbacks have to be invoked (unless you
+ callback.Run();
+ shutdown_callback_.Run();
+};
+
void LaunchInstance::OnCompositorConnectionError() {
LOG(ERROR) << "Exiting due to compositor connection error.";
shutdown_callback_.Run();

Powered by Google App Engine
This is Rietveld 408576698