summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_data_job.h
blob: 0b3c7fad1e2317ff58d6d8c0baea5b01f0130d19 (plain)
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
// Copyright (c) 2012 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 NET_URL_REQUEST_URL_REQUEST_DATA_JOB_H_
#define NET_URL_REQUEST_URL_REQUEST_DATA_JOB_H_

#include <string>

#include "net/url_request/url_request.h"
#include "net/url_request/url_request_simple_job.h"

class GURL;

namespace net {

class HttpResponseHeaders;
class URLRequest;

class NET_EXPORT URLRequestDataJob : public URLRequestSimpleJob {
 public:
  // Extracts info from a data scheme URL. Returns OK if successful. Returns
  // ERR_INVALID_URL otherwise.
  static int BuildResponse(const GURL& url,
                           std::string* mime_type,
                           std::string* charset,
                           std::string* data,
                           HttpResponseHeaders* headers);

  URLRequestDataJob(URLRequest* request, NetworkDelegate* network_delegate);

  // URLRequestSimpleJob
  int GetData(std::string* mime_type,
              std::string* charset,
              std::string* data,
              const CompletionCallback& callback) const override;

 private:
  ~URLRequestDataJob() override;

  DISALLOW_COPY_AND_ASSIGN(URLRequestDataJob);
};

}  // namespace net

#endif  // NET_URL_REQUEST_URL_REQUEST_DATA_JOB_H_