| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2010 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_FILE_JOB_H_ | 5 #ifndef NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
| 6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 6 #define NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
| 14 #include "net/base/file_stream.h" | 14 #include "net/base/file_stream.h" |
| 15 #include "net/http/http_byte_range.h" | 15 #include "net/http/http_byte_range.h" |
| 16 #include "net/url_request/url_request.h" | 16 #include "net/url_request/url_request.h" |
| 17 #include "net/url_request/url_request_job.h" | 17 #include "net/url_request/url_request_job.h" |
| 18 | 18 |
| 19 namespace file_util { | 19 namespace file_util { |
| 20 struct FileInfo; | 20 struct FileInfo; |
| 21 } | 21 } |
| 22 | 22 |
| 23 // A request job that handles reading file URLs | 23 // A request job that handles reading file URLs |
| 24 class URLRequestFileJob : public URLRequestJob { | 24 class URLRequestFileJob : public URLRequestJob { |
| 25 public: | 25 public: |
| 26 URLRequestFileJob(URLRequest* request, const FilePath& file_path); | 26 URLRequestFileJob(net::URLRequest* request, const FilePath& file_path); |
| 27 | 27 |
| 28 virtual void Start(); | 28 virtual void Start(); |
| 29 virtual void Kill(); | 29 virtual void Kill(); |
| 30 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); | 30 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); |
| 31 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | 31 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); |
| 32 virtual bool GetContentEncodings( | 32 virtual bool GetContentEncodings( |
| 33 std::vector<Filter::FilterType>* encoding_type); | 33 std::vector<Filter::FilterType>* encoding_type); |
| 34 virtual bool GetMimeType(std::string* mime_type) const; | 34 virtual bool GetMimeType(std::string* mime_type) const; |
| 35 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers); | 35 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers); |
| 36 | 36 |
| 37 static URLRequest::ProtocolFactory Factory; | 37 static net::URLRequest::ProtocolFactory Factory; |
| 38 | 38 |
| 39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
| 40 static bool AccessDisabled(const FilePath& file_path); | 40 static bool AccessDisabled(const FilePath& file_path); |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 virtual ~URLRequestFileJob(); | 44 virtual ~URLRequestFileJob(); |
| 45 | 45 |
| 46 // The OS-specific full path name of the file | 46 // The OS-specific full path name of the file |
| 47 FilePath file_path_; | 47 FilePath file_path_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 60 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
| 61 class AsyncResolver; | 61 class AsyncResolver; |
| 62 friend class AsyncResolver; | 62 friend class AsyncResolver; |
| 63 scoped_refptr<AsyncResolver> async_resolver_; | 63 scoped_refptr<AsyncResolver> async_resolver_; |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); | 66 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 69 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
| OLD | NEW |