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

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

Issue 40138: Use FilterContext to allow filters to access URLRequestJob data... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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>
9
8 #include "base/file_path.h" 10 #include "base/file_path.h"
9 #include "base/file_util.h" 11 #include "base/file_util.h"
10 #include "net/base/completion_callback.h" 12 #include "net/base/completion_callback.h"
11 #include "net/base/file_stream.h" 13 #include "net/base/file_stream.h"
12 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
13 #include "net/url_request/url_request_job.h" 15 #include "net/url_request/url_request_job.h"
14 16
15 // A request job that handles reading file URLs 17 // A request job that handles reading file URLs
16 class URLRequestFileJob : public URLRequestJob { 18 class URLRequestFileJob : public URLRequestJob {
17 public: 19 public:
18 URLRequestFileJob(URLRequest* request, const FilePath& file_path); 20 URLRequestFileJob(URLRequest* request, const FilePath& file_path);
19 virtual ~URLRequestFileJob(); 21 virtual ~URLRequestFileJob();
20 22
21 virtual void Start(); 23 virtual void Start();
22 virtual void Kill(); 24 virtual void Kill();
23 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); 25 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read);
24 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); 26 virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
25 virtual bool GetMimeType(std::string* mime_type); 27 virtual bool GetMimeType(std::string* mime_type) const;
26 28
27 static URLRequest::ProtocolFactory Factory; 29 static URLRequest::ProtocolFactory Factory;
28 30
29 protected: 31 protected:
30 // The OS-specific full path name of the file 32 // The OS-specific full path name of the file
31 FilePath file_path_; 33 FilePath file_path_;
32 34
33 private: 35 private:
34 void DidResolve(bool exists, const file_util::FileInfo& file_info); 36 void DidResolve(bool exists, const file_util::FileInfo& file_info);
35 void DidRead(int result); 37 void DidRead(int result);
36 38
37 net::CompletionCallbackImpl<URLRequestFileJob> io_callback_; 39 net::CompletionCallbackImpl<URLRequestFileJob> io_callback_;
38 net::FileStream stream_; 40 net::FileStream stream_;
39 bool is_directory_; 41 bool is_directory_;
40 42
41 #if defined(OS_WIN) 43 #if defined(OS_WIN)
42 class AsyncResolver; 44 class AsyncResolver;
43 friend class AsyncResolver; 45 friend class AsyncResolver;
44 scoped_refptr<AsyncResolver> async_resolver_; 46 scoped_refptr<AsyncResolver> async_resolver_;
45 #endif 47 #endif
46 48
47 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); 49 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob);
48 }; 50 };
49 51
50 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ 52 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698