[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / content / utility / utility_process_control_impl.cc
blobf626e5d201129ba655a4694a69123d0a2584ef11
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"
7 #include "base/bind.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"
15 #endif
17 namespace content {
19 namespace {
21 // Called when a static application terminates.
22 void QuitProcess() {
23 UtilityThread::Get()->ReleaseProcessIfNeeded();
26 } // namespace
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));
49 #endif
52 } // namespace content