Home | History | Annotate | Download | only in url_request
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef NET_URL_REQUEST_URL_REQUEST_DATA_JOB_H_
      6 #define NET_URL_REQUEST_URL_REQUEST_DATA_JOB_H_
      7 
      8 #include <string>
      9 
     10 #include "net/url_request/url_request.h"
     11 #include "net/url_request/url_request_simple_job.h"
     12 
     13 class GURL;
     14 
     15 namespace net {
     16 
     17 class HttpResponseHeaders;
     18 class URLRequest;
     19 
     20 class NET_EXPORT URLRequestDataJob : public URLRequestSimpleJob {
     21  public:
     22   // Extracts info from a data scheme URL. Returns OK if successful. Returns
     23   // ERR_INVALID_URL otherwise.
     24   static int BuildResponse(const GURL& url,
     25                            std::string* mime_type,
     26                            std::string* charset,
     27                            std::string* data,
     28                            HttpResponseHeaders* headers);
     29 
     30   URLRequestDataJob(URLRequest* request, NetworkDelegate* network_delegate);
     31 
     32   // URLRequestSimpleJob
     33   virtual int GetData(std::string* mime_type,
     34                       std::string* charset,
     35                       std::string* data,
     36                       const CompletionCallback& callback) const OVERRIDE;
     37 
     38  private:
     39   virtual ~URLRequestDataJob();
     40 
     41   DISALLOW_COPY_AND_ASSIGN(URLRequestDataJob);
     42 };
     43 
     44 }  // namespace net
     45 
     46 #endif  // NET_URL_REQUEST_URL_REQUEST_DATA_JOB_H_
     47