1 // Copyright 2019 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. 4 5 #ifndef COMPONENTS_SERVICES_UNZIP_CONTENT_UNZIP_SERVICE_H_ 6 #define COMPONENTS_SERVICES_UNZIP_CONTENT_UNZIP_SERVICE_H_ 7 8 #include "base/callback.h" 9 #include "components/services/unzip/public/mojom/unzipper.mojom.h" 10 #include "mojo/public/cpp/bindings/pending_receiver.h" 11 #include "mojo/public/cpp/bindings/remote.h" 12 13 namespace unzip { 14 15 // Launches a new instance of the Unzipper service in an isolated, sandboxed 16 // process, and returns a remote interface to control the service. The lifetime 17 // of the process is tied to that of the Remote. May be called from any thread. 18 mojo::PendingRemote<mojom::Unzipper> LaunchUnzipper(); 19 20 // Overrides the logic used by |LaunchUnzipper()| to produce a remote Unzipper, 21 // allowing tests to set up an in-process instance to be used instead of an 22 // out-of-process instance. 23 using LaunchCallback = 24 base::RepeatingCallback<mojo::PendingRemote<mojom::Unzipper>()>; 25 void SetUnzipperLaunchOverrideForTesting(LaunchCallback callback); 26 27 } // namespace unzip 28 29 #endif // COMPONENTS_SERVICES_UNZIP_CONTENT_UNZIP_SERVICE_H_ 30