Chromium Code Reviews| 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 "services/ui/launcher/launcher_app.h" | 5 #include "services/ui/launcher/launcher_app.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 14 matching lines...) Expand all Loading... | |
| 25 auto command_line = base::CommandLine::ForCurrentProcess(); | 25 auto command_line = base::CommandLine::ForCurrentProcess(); |
| 26 command_line->InitFromArgv(app_impl_->args()); | 26 command_line->InitFromArgv(app_impl_->args()); |
| 27 logging::LoggingSettings settings; | 27 logging::LoggingSettings settings; |
| 28 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 28 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 29 logging::InitLogging(settings); | 29 logging::InitLogging(settings); |
| 30 | 30 |
| 31 tracing_.Initialize(app_impl_); | 31 tracing_.Initialize(app_impl_); |
| 32 TRACE_EVENT0("launcher", __func__); | 32 TRACE_EVENT0("launcher", __func__); |
| 33 | 33 |
| 34 for (size_t i = 0; i < command_line->GetArgs().size(); ++i) { | 34 for (size_t i = 0; i < command_line->GetArgs().size(); ++i) { |
| 35 Launch(command_line->GetArgs()[i]); | 35 Launch(command_line->GetArgs()[i], |
| 36 command_line->GetSwitchValueASCII("view_associate_urls")); | |
|
jeffbrown
2016/05/18 18:07:16
It might be better to split the string here so tha
mikejurka
2016/05/18 19:09:10
Doing that would require a conversion of a std::ve
| |
| 36 } | 37 } |
| 37 } | 38 } |
| 38 | 39 |
| 39 bool LauncherApp::ConfigureIncomingConnection( | 40 bool LauncherApp::ConfigureIncomingConnection( |
| 40 mojo::ServiceProviderImpl* service_provider_impl) { | 41 mojo::ServiceProviderImpl* service_provider_impl) { |
| 41 // Only present the launcher interface to the shell. | 42 // Only present the launcher interface to the shell. |
| 42 if (service_provider_impl->connection_context().remote_url.empty()) { | 43 if (service_provider_impl->connection_context().remote_url.empty()) { |
| 43 service_provider_impl->AddService<Launcher>( | 44 service_provider_impl->AddService<Launcher>( |
| 44 [this](const mojo::ConnectionContext& connection_context, | 45 [this](const mojo::ConnectionContext& connection_context, |
| 45 mojo::InterfaceRequest<Launcher> launcher_request) { | 46 mojo::InterfaceRequest<Launcher> launcher_request) { |
| 46 bindings_.AddBinding(this, launcher_request.Pass()); | 47 bindings_.AddBinding(this, launcher_request.Pass()); |
| 47 }); | 48 }); |
| 48 } | 49 } |
| 49 return true; | 50 return true; |
| 50 } | 51 } |
| 51 | 52 |
| 52 void LauncherApp::Launch(const mojo::String& application_url) { | 53 void LauncherApp::Launch(const mojo::String& application_url, |
| 54 const mojo::String& view_associate_urls) { | |
| 53 uint32_t next_id = next_id_++; | 55 uint32_t next_id = next_id_++; |
| 54 std::unique_ptr<LaunchInstance> instance(new LaunchInstance( | 56 std::unique_ptr<LaunchInstance> instance( |
| 55 app_impl_, application_url, base::Bind(&LauncherApp::OnLaunchTermination, | 57 new LaunchInstance(app_impl_, application_url, view_associate_urls, |
| 56 base::Unretained(this), next_id))); | 58 base::Bind(&LauncherApp::OnLaunchTermination, |
| 59 base::Unretained(this), next_id))); | |
| 57 instance->Launch(); | 60 instance->Launch(); |
| 58 launch_instances_.emplace(next_id, std::move(instance)); | 61 launch_instances_.emplace(next_id, std::move(instance)); |
| 59 } | 62 } |
| 60 | 63 |
| 61 void LauncherApp::OnLaunchTermination(uint32_t id) { | 64 void LauncherApp::OnLaunchTermination(uint32_t id) { |
| 62 launch_instances_.erase(id); | 65 launch_instances_.erase(id); |
| 63 if (launch_instances_.empty()) { | 66 if (launch_instances_.empty()) { |
| 64 app_impl_->Terminate(); | 67 app_impl_->Terminate(); |
| 65 } | 68 } |
| 66 } | 69 } |
| 67 | 70 |
| 68 } // namespace launcher | 71 } // namespace launcher |
| OLD | NEW |