1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
android_webview / browser / network_service / aw_proxy_config_monitor.h [blame]
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_PROXY_CONFIG_MONITOR_H_
#define ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_PROXY_CONFIG_MONITOR_H_
#include <memory>
#include <string>
#include <vector>
#include "base/no_destructor.h"
#include "mojo/public/cpp/bindings/remote_set.h"
#include "net/proxy_resolution/proxy_config_service_android.h"
#include "services/network/public/mojom/network_service.mojom.h"
namespace network {
namespace mojom {
class ProxyConfigClient;
}
} // namespace network
namespace android_webview {
// This class configures proxy settings for NetworkContext if network service
// is enabled.
class AwProxyConfigMonitor : public net::ProxyConfigService::Observer {
public:
AwProxyConfigMonitor(const AwProxyConfigMonitor&) = delete;
AwProxyConfigMonitor& operator=(const AwProxyConfigMonitor&) = delete;
static AwProxyConfigMonitor* GetInstance();
void AddProxyToNetworkContextParams(
network::mojom::NetworkContextParams* network_context_params);
std::string SetProxyOverride(
const std::vector<net::ProxyConfigServiceAndroid::ProxyOverrideRule>&
proxy_rules,
const std::vector<std::string>& bypass_rules,
const bool reverse_bypass,
base::OnceClosure callback);
void ClearProxyOverride(base::OnceClosure callback);
private:
AwProxyConfigMonitor();
~AwProxyConfigMonitor() override;
friend class base::NoDestructor<AwProxyConfigMonitor>;
// net::ProxyConfigService::Observer implementation:
void OnProxyConfigChanged(
const net::ProxyConfigWithAnnotation& config,
net::ProxyConfigService::ConfigAvailability availability) override;
void FlushProxyConfig(base::OnceClosure callback);
std::unique_ptr<net::ProxyConfigServiceAndroid> proxy_config_service_android_;
mojo::RemoteSet<network::mojom::ProxyConfigClient> proxy_config_client_set_;
};
} // namespace android_webview
#endif // ANDROID_WEBVIEW_BROWSER_NETWORK_SERVICE_AW_PROXY_CONFIG_MONITOR_H_