diff --git a/engine/src/flutter/tools/debugger/debugger.cc b/engine/src/flutter/tools/debugger/debugger.cc index c540b15f93..1bf43e4287 100644 --- a/engine/src/flutter/tools/debugger/debugger.cc +++ b/engine/src/flutter/tools/debugger/debugger.cc @@ -28,12 +28,19 @@ base::WeakPtr SkyDebugger::GetWeakPtr() { void SkyDebugger::Initialize(mojo::ApplicationImpl* app) { window_manager_app_->Initialize(app); app->ConnectToApplication("mojo:sky_debugger_prompt"); + + // Format: --args-for="app_url default_url" + if (app->args().size() > 1) + default_url_ = app->args()[1]; } bool SkyDebugger::ConfigureIncomingConnection( mojo::ApplicationConnection* connection) { window_manager_app_->ConfigureIncomingConnection(connection); connection->AddService(this); + + if (!default_url_.empty()) + NavigateToURL(default_url_); // Schedule a navigation in the new embedding. return true; } diff --git a/engine/src/flutter/tools/debugger/debugger.h b/engine/src/flutter/tools/debugger/debugger.h index d7412a257e..5f8904a4f5 100644 --- a/engine/src/flutter/tools/debugger/debugger.h +++ b/engine/src/flutter/tools/debugger/debugger.h @@ -69,8 +69,11 @@ class SkyDebugger : public mojo::ApplicationDelegate, scoped_ptr window_manager_app_; + // TODO(eseidel): This is per-embedding state and should be separate + // from the ApplicationDelegate! mojo::View* root_; mojo::View* content_; + std::string default_url_; std::string pending_url_; mojo::ServiceProviderPtr viewer_services_; diff --git a/engine/src/flutter/tools/debugger/prompt/prompt.cc b/engine/src/flutter/tools/debugger/prompt/prompt.cc index f5340c4521..c53554c142 100644 --- a/engine/src/flutter/tools/debugger/prompt/prompt.cc +++ b/engine/src/flutter/tools/debugger/prompt/prompt.cc @@ -42,10 +42,11 @@ class Prompt : public mojo::ApplicationDelegate, // Overridden from mojo::ApplicationDelegate: virtual void Initialize(mojo::ApplicationImpl* app) override { app->ConnectToService("mojo:tracing", &tracing_); - // app_url, command_port, url_to_load + // Format: --args-for="app_url command_port" if (app->args().size() < 2) { LOG(ERROR) << "--args-for required to specify command_port"; - exit(2); + mojo::ApplicationImpl::Terminate(); + return; } base::StringToUint(app->args()[1], &command_port_); @@ -54,10 +55,9 @@ class Prompt : public mojo::ApplicationDelegate, new net::TCPServerSocket(NULL, net::NetLog::Source())); int result = server_socket->ListenWithAddressAndPort("0.0.0.0", command_port_, 1); if (result != net::OK) { - // FIXME: Should we quit here? LOG(ERROR) << "Failed to bind to port " << command_port_ - << " skydb commands will not work, exiting."; - exit(2); + << " skydb commands will not work."; + mojo::ApplicationImpl::Terminate(); return; } web_server_.reset(new net::HttpServer(server_socket.Pass(), this));