blob: af0be03e8fde7027d0cc09684fb914b8834c2a32 [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"
[email protected]51678ad2011-12-02 19:07:5012#include "base/compiler_specific.h"
avi1023d012015-12-25 02:39:1413#include "base/macros.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"
[email protected]5c30b5e02013-05-30 03:46:0816#include "third_party/WebKit/public/platform/WebURLRequest.h"
initial.commitf5b16fe2008-07-27 00:20:5117
18class GURL;
initial.commitf5b16fe2008-07-27 00:20:5119
[email protected]180ef242013-11-07 06:50:4620namespace blink {
yhirano505d1e62017-05-08 10:37:3521class WebLocalFrame;
[email protected]f6134ff2009-07-07 16:44:3922class WebURLLoader;
[email protected]f6134ff2009-07-07 16:44:3923}
24
[email protected]f8c700ba2013-05-14 08:25:4925namespace content {
[email protected]f6134ff2009-07-07 16:44:3926
tyoshino6d767112016-10-24 06:44:5327class ResourceFetcherImpl : public ResourceFetcher {
initial.commitf5b16fe2008-07-27 00:20:5128 public:
[email protected]885e54f12013-11-25 21:01:5829 // ResourceFetcher implementation:
dcheng6d18e402014-10-21 12:32:5230 void SetMethod(const std::string& method) override;
31 void SetBody(const std::string& body) override;
32 void SetHeader(const std::string& header, const std::string& value) override;
yhirano505d1e62017-05-08 10:37:3533 void Start(blink::WebLocalFrame* frame,
dcheng6d18e402014-10-21 12:32:5234 blink::WebURLRequest::RequestContext request_context,
dcheng6d18e402014-10-21 12:32:5235 const Callback& callback) override;
36 void SetTimeout(const base::TimeDelta& timeout) override;
initial.commitf5b16fe2008-07-27 00:20:5137
[email protected]885e54f12013-11-25 21:01:5838 private:
39 friend class ResourceFetcher;
40
tyoshino6d767112016-10-24 06:44:5341 class ClientImpl;
42
[email protected]ec5b02bb2014-01-28 13:32:0343 explicit ResourceFetcherImpl(const GURL& url);
[email protected]1a040f92013-11-14 06:08:4644
avi5c77d212015-09-25 20:08:2545 ~ResourceFetcherImpl() override;
initial.commitf5b16fe2008-07-27 00:20:5146
tyoshino6d767112016-10-24 06:44:5347 void OnLoadComplete();
dcheng6d18e402014-10-21 12:32:5248 void Cancel() override;
[email protected]f6134ff2009-07-07 16:44:3949
dchengcedca5612016-04-09 01:40:1550 std::unique_ptr<blink::WebURLLoader> loader_;
tyoshino6d767112016-10-24 06:44:5351 std::unique_ptr<ClientImpl> client_;
mlamourif484b43a2015-01-14 19:03:4352
kinukoa2b5c2e2016-07-13 02:12:3753 // Request to send.
[email protected]ec5b02bb2014-01-28 13:32:0354 blink::WebURLRequest request_;
55
[email protected]1a040f92013-11-14 06:08:4656 // Limit how long to wait for the server.
danakj8c3eb802015-09-24 07:53:0057 base::OneShotTimer timeout_timer_;
initial.commitf5b16fe2008-07-27 00:20:5158
[email protected]885e54f12013-11-25 21:01:5859 DISALLOW_COPY_AND_ASSIGN(ResourceFetcherImpl);
initial.commitf5b16fe2008-07-27 00:20:5160};
61
[email protected]f8c700ba2013-05-14 08:25:4962} // namespace content
[email protected]f6134ff2009-07-07 16:44:3963
tfarinabccc34c72015-02-27 21:32:1564#endif // CONTENT_RENDERER_FETCHERS_RESOURCE_FETCHER_IMPL_H_