1 // Copyright 2019 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/file_util_service.h"
7 #include "build/build_config.h"
8 #include "chrome/grit/generated_resources.h"
9 #include "chrome/services/file_util/public/mojom/file_util_service.mojom.h"
10 #include "components/strings/grit/components_strings.h"
11 #include "content/public/browser/service_process_host.h"
12 #include "content/public/browser/service_process_host_passkeys.h"
15 // Class allows us to friend the passkeys we need to launch the service.
16 class FileUtilServiceLauncher {
18 static mojo::PendingRemote<chrome::mojom::FileUtilService>
19 LaunchFileUtilService() {
20 mojo::PendingRemote<chrome::mojom::FileUtilService> remote;
21 content::ServiceProcessHost::Launch<chrome::mojom::FileUtilService>(
22 remote.InitWithNewPipeAndPassReceiver(),
23 content::ServiceProcessHost::Options()
25 // The FileUtilService supports archive inspection, which uses unrar
26 // for inspecting rar archives. Unrar depends on user32.dll for
27 // handling upper/lowercase.
28 .WithPinUser32(content::ServiceProcessHostPinUser32::GetPassKey())
29 #endif // BUILDFLAG(IS_WIN)
30 .WithDisplayName(IDS_UTILITY_PROCESS_FILE_UTILITY_NAME)
37 mojo::PendingRemote<chrome::mojom::FileUtilService> LaunchFileUtilService() {
38 return chrome::FileUtilServiceLauncher::LaunchFileUtilService();