// Copyright 2019 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 ANDROID_WEBVIEW_BROWSER_AW_PAC_PROCESSOR_H_ #define ANDROID_WEBVIEW_BROWSER_AW_PAC_PROCESSOR_H_ #include #include "base/android/scoped_java_ref.h" #include "base/task/single_thread_task_runner.h" #include "base/threading/thread.h" #include "net/log/net_log_with_source.h" #include "services/proxy_resolver/proxy_host_resolver.h" #include "services/proxy_resolver/proxy_resolver_v8_tracing.h" namespace android_webview { class Job; class HostResolver; class AwPacProcessor { public: AwPacProcessor(); AwPacProcessor(const AwPacProcessor&) = delete; AwPacProcessor& operator=(const AwPacProcessor&) = delete; ~AwPacProcessor(); void DestroyNative(JNIEnv* env, const base::android::JavaParamRef& obj); jboolean SetProxyScript(JNIEnv* env, const base::android::JavaParamRef& obj, const base::android::JavaParamRef& jscript); bool SetProxyScript(std::string script); base::android::ScopedJavaLocalRef MakeProxyRequest( JNIEnv* env, const base::android::JavaParamRef& obj, const base::android::JavaParamRef& jurl); bool MakeProxyRequest(std::string url, std::string* result); void SetNetworkAndLinkAddresses( JNIEnv* env, net_handle_t net_handle, const base::android::JavaParamRef& addresses); private: void Destroy(base::WaitableEvent* event); void SetProxyScriptNative( std::unique_ptr* request, const std::string& script, net::CompletionOnceCallback complete); void MakeProxyRequestNative( std::unique_ptr* request, const std::string& url, net::ProxyInfo* proxy_info, net::CompletionOnceCallback complete); friend class Job; friend class SetProxyScriptJob; friend class MakeProxyRequestJob; std::unique_ptr proxy_resolver_; std::unique_ptr host_resolver_; std::set jobs_; }; } // namespace android_webview #endif // ANDROID_WEBVIEW_BROWSER_AW_PAC_PROCESSOR_H_