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