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
android_webview / nonembedded / net / network_impl.h [blame]
// Copyright 2021 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_NONEMBEDDED_NET_NETWORK_IMPL_H_
#define ANDROID_WEBVIEW_NONEMBEDDED_NET_NETWORK_IMPL_H_
#include <memory>
#include "android_webview/nonembedded/net/network_fetcher_task.h"
#include "base/functional/callback_forward.h"
#include "components/update_client/network.h"
namespace android_webview {
class NetworkFetcherFactoryImpl : public update_client::NetworkFetcherFactory {
public:
NetworkFetcherFactoryImpl();
NetworkFetcherFactoryImpl(const NetworkFetcherFactoryImpl&) = delete;
NetworkFetcherFactoryImpl& operator=(const NetworkFetcherFactoryImpl&) =
delete;
std::unique_ptr<update_client::NetworkFetcher> Create() const override;
protected:
~NetworkFetcherFactoryImpl() override;
};
class NetworkFetcherImpl : public update_client::NetworkFetcher {
public:
NetworkFetcherImpl();
~NetworkFetcherImpl() override;
NetworkFetcherImpl(const NetworkFetcherImpl&) = delete;
NetworkFetcherImpl& operator=(const NetworkFetcherImpl&) = delete;
// NetworkFetcher overrides.
void PostRequest(
const GURL& url,
const std::string& post_data,
const std::string& content_type,
const base::flat_map<std::string, std::string>& post_additional_headers,
ResponseStartedCallback response_started_callback,
ProgressCallback progress_callback,
PostRequestCompleteCallback post_request_complete_callback) override;
base::OnceClosure DownloadToFile(
const GURL& url,
const base::FilePath& file_path,
ResponseStartedCallback response_started_callback,
ProgressCallback progress_callback,
DownloadToFileCompleteCallback download_to_file_complete_callback)
override;
private:
std::unique_ptr<NetworkFetcherTask> network_task_;
};
} // namespace android_webview
#endif // ANDROID_WEBVIEW_NONEMBEDDED_NET_NETWORK_IMPL_H_