// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FUCHSIA_ENGINE_CONTEXT_PROVIDER_IMPL_H_ #define FUCHSIA_ENGINE_CONTEXT_PROVIDER_IMPL_H_ #include #include #include #include #include "base/callback.h" #include "base/macros.h" #include "base/values.h" #include "fuchsia/engine/web_engine_export.h" namespace base { class CommandLine; struct LaunchOptions; class Process; } // namespace base class WEB_ENGINE_EXPORT ContextProviderImpl : public fuchsia::web::ContextProvider, public fuchsia::web::Debug { public: using LaunchCallbackForTest = base::RepeatingCallback; // Handle Id used to pass the request channel to Context processes. static const uint32_t kContextRequestHandleId; ContextProviderImpl(); ~ContextProviderImpl() override; // fuchsia::web::ContextProvider implementation. void Create( fuchsia::web::CreateContextParams params, fidl::InterfaceRequest context_request) override; // Sets a |launch| callback to use instead of calling LaunchProcess() to // create Context processes. void SetLaunchCallbackForTest(LaunchCallbackForTest launch); // Sets a config to use for the test, instead of looking for the config file. void set_config_for_test(base::Value config) { config_for_test_ = std::move(config); } private: // fuchsia::web::Debug implementation. void EnableDevTools( fidl::InterfaceHandle listener, EnableDevToolsCallback callback) override; // Set by tests to use to launch Context child processes, e.g. to allow a // fake Context process to be launched. LaunchCallbackForTest launch_for_test_; // Set by configuration tests. base::Value config_for_test_; // The DevToolsListeners registered via the Debug interface. fidl::InterfacePtrSet devtools_listeners_; DISALLOW_COPY_AND_ASSIGN(ContextProviderImpl); }; #endif // FUCHSIA_ENGINE_CONTEXT_PROVIDER_IMPL_H_