blob: 0d93e7dd606263c944816638b991b96946fdc40e [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2019 The Chromium Authors
Ken Rockot2925f5002019-08-06 01:16:162// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "chrome/browser/file_util_service.h"
6
7#include "chrome/grit/generated_resources.h"
Alex Gough5a90be02021-08-13 06:00:358#include "chrome/services/file_util/public/mojom/file_util_service.mojom.h"
Ken Rockot2925f5002019-08-06 01:16:169#include "components/strings/grit/components_strings.h"
10#include "content/public/browser/service_process_host.h"
Alex Gough71f4a4b2023-05-21 22:06:4711
Alex Gough71f4a4b2023-05-21 22:06:4712// Class allows us to friend the passkeys we need to launch the service.
13class FileUtilServiceLauncher {
14 public:
15 static mojo::PendingRemote<chrome::mojom::FileUtilService>
16 LaunchFileUtilService() {
17 mojo::PendingRemote<chrome::mojom::FileUtilService> remote;
18 content::ServiceProcessHost::Launch<chrome::mojom::FileUtilService>(
19 remote.InitWithNewPipeAndPassReceiver(),
20 content::ServiceProcessHost::Options()
Alex Gough71f4a4b2023-05-21 22:06:4721 .WithDisplayName(IDS_UTILITY_PROCESS_FILE_UTILITY_NAME)
22 .Pass());
23 return remote;
24 }
25};
Ken Rockot2925f5002019-08-06 01:16:1626
27mojo::PendingRemote<chrome::mojom::FileUtilService> LaunchFileUtilService() {
Hyungwook Leef4ada792024-09-13 08:13:2028 return FileUtilServiceLauncher::LaunchFileUtilService();
Ken Rockot2925f5002019-08-06 01:16:1629}