Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: net/url_request/url_request_file_job.h

Issue 92149: Supports single range request with file protocol... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/net_error_list.h ('k') | net/url_request/url_request_file_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "net/base/completion_callback.h" 12 #include "net/base/completion_callback.h"
13 #include "net/base/file_stream.h" 13 #include "net/base/file_stream.h"
14 #include "net/http/http_byte_range.h"
14 #include "net/url_request/url_request.h" 15 #include "net/url_request/url_request.h"
15 #include "net/url_request/url_request_job.h" 16 #include "net/url_request/url_request_job.h"
16 17
17 // A request job that handles reading file URLs 18 // A request job that handles reading file URLs
18 class URLRequestFileJob : public URLRequestJob { 19 class URLRequestFileJob : public URLRequestJob {
19 public: 20 public:
20 URLRequestFileJob(URLRequest* request, const FilePath& file_path); 21 URLRequestFileJob(URLRequest* request, const FilePath& file_path);
21 virtual ~URLRequestFileJob(); 22 virtual ~URLRequestFileJob();
22 23
23 virtual void Start(); 24 virtual void Start();
24 virtual void Kill(); 25 virtual void Kill();
25 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); 26 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read);
26 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); 27 virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
27 virtual bool GetMimeType(std::string* mime_type) const; 28 virtual bool GetMimeType(std::string* mime_type) const;
28 virtual void GetResponseInfo(net::HttpResponseInfo* info); 29 virtual void GetResponseInfo(net::HttpResponseInfo* info);
30 virtual void SetExtraRequestHeaders(const std::string& headers);
29 31
30 static URLRequest::ProtocolFactory Factory; 32 static URLRequest::ProtocolFactory Factory;
31 33
32 protected: 34 protected:
33 // The OS-specific full path name of the file 35 // The OS-specific full path name of the file
34 FilePath file_path_; 36 FilePath file_path_;
35 37
36 private: 38 private:
37 void DidResolve(bool exists, const file_util::FileInfo& file_info); 39 void DidResolve(bool exists, const file_util::FileInfo& file_info);
38 void DidRead(int result); 40 void DidRead(int result);
39 41
40 net::CompletionCallbackImpl<URLRequestFileJob> io_callback_; 42 net::CompletionCallbackImpl<URLRequestFileJob> io_callback_;
41 net::FileStream stream_; 43 net::FileStream stream_;
42 bool is_directory_; 44 bool is_directory_;
43 45
46 net::HttpByteRange byte_range_;
47 int64 remaining_bytes_;
48
44 #if defined(OS_WIN) 49 #if defined(OS_WIN)
45 class AsyncResolver; 50 class AsyncResolver;
46 friend class AsyncResolver; 51 friend class AsyncResolver;
47 scoped_refptr<AsyncResolver> async_resolver_; 52 scoped_refptr<AsyncResolver> async_resolver_;
48 #endif 53 #endif
49 54
50 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); 55 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob);
51 }; 56 };
52 57
53 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ 58 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_
OLDNEW
« no previous file with comments | « net/base/net_error_list.h ('k') | net/url_request/url_request_file_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698