1 // Copyright 2020 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 #ifndef CHROME_BROWSER_SERVICE_SANDBOX_TYPE_H_
6 #define CHROME_BROWSER_SERVICE_SANDBOX_TYPE_H_
8 #include "build/build_config.h"
9 #include "content/public/browser/sandbox_type.h"
10 #include "content/public/browser/service_process_host.h"
12 #if !defined(OS_ANDROID)
13 #include "chrome/services/speech/buildflags.h"
14 #endif // !defined(OS_ANDROID)
16 // This file maps service classes to sandbox types. Services which
17 // require a non-utility sandbox can be added here. See
18 // ServiceProcessHost::Launch() for how these templates are consumed.
20 // chrome::mojom::RemovableStorageWriter
23 class RemovableStorageWriter;
28 inline content::SandboxType
29 content::GetServiceSandboxType<chrome::mojom::RemovableStorageWriter>() {
31 return SandboxType::kNoSandboxAndElevatedPrivileges;
33 return SandboxType::kNoSandbox;
34 #endif // !defined(OS_WIN)
37 // chrome::mojom::UtilReadIcon
46 inline content::SandboxType
47 content::GetServiceSandboxType<chrome::mojom::UtilReadIcon>() {
48 return content::SandboxType::kIconReader;
50 #endif // defined(OS_WIN)
52 // chrome::mojom::UtilWin
61 inline content::SandboxType
62 content::GetServiceSandboxType<chrome::mojom::UtilWin>() {
63 return content::SandboxType::kNoSandbox;
65 #endif // defined(OS_WIN)
67 // chrome::mojom::ProfileImport
75 inline content::SandboxType
76 content::GetServiceSandboxType<chrome::mojom::ProfileImport>() {
77 return content::SandboxType::kNoSandbox;
80 // media::mojom::SpeechRecognitionService
81 #if !defined(OS_ANDROID)
82 #if BUILDFLAG(ENABLE_SODA)
85 class SpeechRecognitionService;
90 inline content::SandboxType
91 content::GetServiceSandboxType<media::mojom::SpeechRecognitionService>() {
92 return content::SandboxType::kSpeechRecognition;
94 #endif // BUILDFLAG(ENABLE_SODA)
95 #endif // !defined(OS_ANDROID)
97 // printing::mojom::PrintingService
101 class PrintingService;
103 } // namespace printing
106 inline content::SandboxType
107 content::GetServiceSandboxType<printing::mojom::PrintingService>() {
108 return content::SandboxType::kPdfConversion;
110 #endif // defined(OS_WIN)
112 // proxy_resolver::mojom::ProxyResolverFactory
114 namespace proxy_resolver {
116 class ProxyResolverFactory;
118 } // namespace proxy_resolver
121 inline content::SandboxType
122 content::GetServiceSandboxType<proxy_resolver::mojom::ProxyResolverFactory>() {
123 return content::SandboxType::kProxyResolver;
125 #endif // defined(OS_WIN)
127 // quarantine::mojom::Quarantine
129 namespace quarantine {
133 } // namespace quarantine
136 inline content::SandboxType
137 content::GetServiceSandboxType<quarantine::mojom::Quarantine>() {
138 return content::SandboxType::kNoSandbox;
140 #endif // defined(OS_WIN)
142 // sharing::mojom::Sharing
143 #if !defined(OS_MACOSX)
148 } // namespace sharing
151 inline content::SandboxType
152 content::GetServiceSandboxType<sharing::mojom::Sharing>() {
153 return content::SandboxType::kSharingService;
155 #endif // !defined(OS_MACOSX)
157 #endif // CHROME_BROWSER_SERVICE_SANDBOX_TYPE_H_