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
3 // found in the LICENSE file.
5 #include "content/utility/utility_process_control_impl.h"
8 #include "content/public/common/content_client.h"
9 #include "content/public/utility/content_utility_client.h"
10 #include "content/public/utility/utility_thread.h"
11 #include "mojo/shell/static_application_loader.h"
13 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS)
14 #include "media/mojo/services/mojo_media_application.h"
21 // Called when a static application terminates.
23 UtilityThread::Get()->ReleaseProcessIfNeeded();
28 UtilityProcessControlImpl::UtilityProcessControlImpl() {}
30 UtilityProcessControlImpl::~UtilityProcessControlImpl() {}
32 void UtilityProcessControlImpl::RegisterApplicationLoaders(
33 URLToLoaderMap
* url_to_loader_map
) {
34 URLToLoaderMap
& map_ref
= *url_to_loader_map
;
36 ContentUtilityClient::StaticMojoApplicationMap apps
;
37 GetContentClient()->utility()->RegisterMojoApplications(&apps
);
39 for (const auto& entry
: apps
) {
40 map_ref
[entry
.first
] = new mojo::shell::StaticApplicationLoader(
41 entry
.second
, base::Bind(&QuitProcess
));
44 #if defined(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS)
45 map_ref
[media::MojoMediaApplication::AppUrl()] =
46 new mojo::shell::StaticApplicationLoader(
47 base::Bind(&media::MojoMediaApplication::CreateApp
),
48 base::Bind(&QuitProcess
));
52 } // namespace content