blob: a2932a2a9ef614a5f534b606ef3aaf294e7d3b86 [file] [log] [blame]
[email protected]3b63f8f42011-03-28 01:54:151// Copyright (c) 2011 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commitf5b16fe2008-07-27 00:20:514
tfarinabccc34c72015-02-27 21:32:155#ifndef CONTENT_RENDERER_FETCHERS_RESOURCE_FETCHER_IMPL_H_
6#define CONTENT_RENDERER_FETCHERS_RESOURCE_FETCHER_IMPL_H_
initial.commitf5b16fe2008-07-27 00:20:517
dchengcedca5612016-04-09 01:40:158#include <memory>
initial.commitf5b16fe2008-07-27 00:20:519#include <string>
10
[email protected]92d86a2c2011-11-22 00:49:2311#include "base/callback.h"
avi1023d012015-12-25 02:39:1412#include "base/macros.h"
Takashi Toyoshima6ece8de2017-08-30 11:36:4813#include "base/time/time.h"
[email protected]abb522162013-06-28 01:54:1614#include "base/timer/timer.h"
[email protected]885e54f12013-11-25 21:01:5815#include "content/public/renderer/resource_fetcher.h"
Takashi Toyoshima6ece8de2017-08-30 11:36:4816#include "net/http/http_request_headers.h"
John Abd-El-Malek1df61792018-01-12 20:40:4517#include "services/network/public/cpp/resource_request.h"
[email protected]5c30b5e02013-05-30 03:46:0818#include "third_party/WebKit/public/platform/WebURLRequest.h"
initial.commitf5b16fe2008-07-27 00:20:5119
20class GURL;
initial.commitf5b16fe2008-07-27 00:20:5121
[email protected]180ef242013-11-07 06:50:4622namespace blink {
yhirano505d1e62017-05-08 10:37:3523class WebLocalFrame;
[email protected]f6134ff2009-07-07 16:44:3924}
25
[email protected]f8c700ba2013-05-14 08:25:4926namespace content {
[email protected]f6134ff2009-07-07 16:44:3927
tyoshino6d767112016-10-24 06:44:5328class ResourceFetcherImpl : public ResourceFetcher {
initial.commitf5b16fe2008-07-27 00:20:5129 public:
[email protected]885e54f12013-11-25 21:01:5830 // ResourceFetcher implementation:
dcheng6d18e402014-10-21 12:32:5231 void SetMethod(const std::string& method) override;
32 void SetBody(const std::string& body) override;
33 void SetHeader(const std::string& header, const std::string& value) override;
yhirano505d1e62017-05-08 10:37:3534 void Start(blink::WebLocalFrame* frame,
dcheng6d18e402014-10-21 12:32:5235 blink::WebURLRequest::RequestContext request_context,
Chong Zhangb7c8d1ce2018-03-13 19:14:1136 scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
Takashi Toyoshima6448dc952017-08-31 07:20:4837 const net::NetworkTrafficAnnotationTag& annotation_tag,
Takashi Toyoshimac3bd1cf2017-09-05 06:32:4738 Callback callback,
Takashi Toyoshima6448dc952017-08-31 07:20:4839 size_t maximum_download_size) override;
dcheng6d18e402014-10-21 12:32:5240 void SetTimeout(const base::TimeDelta& timeout) override;
initial.commitf5b16fe2008-07-27 00:20:5141
[email protected]885e54f12013-11-25 21:01:5842 private:
43 friend class ResourceFetcher;
44
tyoshino6d767112016-10-24 06:44:5345 class ClientImpl;
46
[email protected]ec5b02bb2014-01-28 13:32:0347 explicit ResourceFetcherImpl(const GURL& url);
[email protected]1a040f92013-11-14 06:08:4648
avi5c77d212015-09-25 20:08:2549 ~ResourceFetcherImpl() override;
initial.commitf5b16fe2008-07-27 00:20:5150
tyoshino6d767112016-10-24 06:44:5351 void OnLoadComplete();
Takashi Toyoshimabeba9322017-09-07 06:27:1452 void OnTimeout();
[email protected]f6134ff2009-07-07 16:44:3953
tyoshino6d767112016-10-24 06:44:5354 std::unique_ptr<ClientImpl> client_;
mlamourif484b43a2015-01-14 19:03:4355
kinukoa2b5c2e2016-07-13 02:12:3756 // Request to send.
John Abd-El-Malek1df61792018-01-12 20:40:4557 network::ResourceRequest request_;
Takashi Toyoshima6ece8de2017-08-30 11:36:4858
[email protected]1a040f92013-11-14 06:08:4659 // Limit how long to wait for the server.
danakj8c3eb802015-09-24 07:53:0060 base::OneShotTimer timeout_timer_;
initial.commitf5b16fe2008-07-27 00:20:5161
[email protected]885e54f12013-11-25 21:01:5862 DISALLOW_COPY_AND_ASSIGN(ResourceFetcherImpl);
initial.commitf5b16fe2008-07-27 00:20:5163};
64
[email protected]f8c700ba2013-05-14 08:25:4965} // namespace content
[email protected]f6134ff2009-07-07 16:44:3966
tfarinabccc34c72015-02-27 21:32:1567#endif // CONTENT_RENDERER_FETCHERS_RESOURCE_FETCHER_IMPL_H_