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

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

Issue 5755004: net: Add namespace net to URLRequestFileJob. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years 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-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 "base/task.h" 13 #include "base/task.h"
14 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
15 #include "net/base/file_stream.h" 15 #include "net/base/file_stream.h"
16 #include "net/http/http_byte_range.h" 16 #include "net/http/http_byte_range.h"
17 #include "net/url_request/url_request.h" 17 #include "net/url_request/url_request.h"
18 #include "net/url_request/url_request_job.h" 18 #include "net/url_request/url_request_job.h"
19 19
20 namespace file_util { 20 namespace file_util {
21 struct FileInfo; 21 struct FileInfo;
22 } 22 }
23 23
24 namespace net {
25
24 // A request job that handles reading file URLs 26 // A request job that handles reading file URLs
25 class URLRequestFileJob : public net::URLRequestJob { 27 class URLRequestFileJob : public URLRequestJob {
26 public: 28 public:
27 URLRequestFileJob(net::URLRequest* request, const FilePath& file_path); 29 URLRequestFileJob(URLRequest* request, const FilePath& file_path);
28 30
29 virtual void Start(); 31 virtual void Start();
30 virtual void Kill(); 32 virtual void Kill();
31 virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read); 33 virtual bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read);
32 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); 34 virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
33 virtual bool GetContentEncodings( 35 virtual bool GetContentEncodings(
34 std::vector<Filter::FilterType>* encoding_type); 36 std::vector<Filter::FilterType>* encoding_type);
35 virtual bool GetMimeType(std::string* mime_type) const; 37 virtual bool GetMimeType(std::string* mime_type) const;
36 virtual void SetExtraRequestHeaders(const net::HttpRequestHeaders& headers); 38 virtual void SetExtraRequestHeaders(const HttpRequestHeaders& headers);
37 39
38 static net::URLRequest::ProtocolFactory Factory; 40 static URLRequest::ProtocolFactory Factory;
39 41
40 #if defined(OS_CHROMEOS) 42 #if defined(OS_CHROMEOS)
41 static bool AccessDisabled(const FilePath& file_path); 43 static bool AccessDisabled(const FilePath& file_path);
42 #endif 44 #endif
43 45
44 protected: 46 protected:
45 virtual ~URLRequestFileJob(); 47 virtual ~URLRequestFileJob();
46 48
47 // The OS-specific full path name of the file 49 // The OS-specific full path name of the file
48 FilePath file_path_; 50 FilePath file_path_;
49 51
50 private: 52 private:
51 void DidResolve(bool exists, const base::PlatformFileInfo& file_info); 53 void DidResolve(bool exists, const base::PlatformFileInfo& file_info);
52 void DidRead(int result); 54 void DidRead(int result);
53 55
54 net::CompletionCallbackImpl<URLRequestFileJob> io_callback_; 56 CompletionCallbackImpl<URLRequestFileJob> io_callback_;
55 net::FileStream stream_; 57 FileStream stream_;
56 bool is_directory_; 58 bool is_directory_;
57 59
58 net::HttpByteRange byte_range_; 60 HttpByteRange byte_range_;
59 int64 remaining_bytes_; 61 int64 remaining_bytes_;
60 62
61 #if defined(OS_WIN) 63 #if defined(OS_WIN)
62 class AsyncResolver; 64 class AsyncResolver;
63 friend class AsyncResolver; 65 friend class AsyncResolver;
64 scoped_refptr<AsyncResolver> async_resolver_; 66 scoped_refptr<AsyncResolver> async_resolver_;
65 #endif 67 #endif
66 68
67 ScopedRunnableMethodFactory<URLRequestFileJob> method_factory_; 69 ScopedRunnableMethodFactory<URLRequestFileJob> method_factory_;
68 70
69 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); 71 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob);
70 }; 72 };
71 73
74 } // namespace net
75
72 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ 76 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/url_request_mock_net_error_job.cc ('k') | net/url_request/url_request_file_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698