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> |
(...skipping 10 matching lines...) Expand all Loading... |
21 struct FileInfo; | 21 struct FileInfo; |
22 } | 22 } |
23 | 23 |
24 namespace net { | 24 namespace net { |
25 | 25 |
26 // A request job that handles reading file URLs | 26 // A request job that handles reading file URLs |
27 class URLRequestFileJob : public URLRequestJob { | 27 class URLRequestFileJob : public URLRequestJob { |
28 public: | 28 public: |
29 URLRequestFileJob(URLRequest* request, const FilePath& file_path); | 29 URLRequestFileJob(URLRequest* request, const FilePath& file_path); |
30 | 30 |
| 31 static URLRequest::ProtocolFactory Factory; |
| 32 |
| 33 #if defined(OS_CHROMEOS) |
| 34 static bool AccessDisabled(const FilePath& file_path); |
| 35 #endif |
| 36 |
| 37 // URLRequestJob: |
31 virtual void Start(); | 38 virtual void Start(); |
32 virtual void Kill(); | 39 virtual void Kill(); |
33 virtual bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read); | 40 virtual bool ReadRawData(IOBuffer* buf, int buf_size, int* bytes_read); |
34 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); | 41 virtual bool IsRedirectResponse(GURL* location, int* http_status_code); |
35 virtual bool GetContentEncodings( | 42 virtual bool GetContentEncodings( |
36 std::vector<Filter::FilterType>* encoding_type); | 43 std::vector<Filter::FilterType>* encoding_type); |
37 virtual bool GetMimeType(std::string* mime_type) const; | 44 virtual bool GetMimeType(std::string* mime_type) const; |
38 virtual void SetExtraRequestHeaders(const HttpRequestHeaders& headers); | 45 virtual void SetExtraRequestHeaders(const HttpRequestHeaders& headers); |
39 | 46 |
40 static URLRequest::ProtocolFactory Factory; | |
41 | |
42 #if defined(OS_CHROMEOS) | |
43 static bool AccessDisabled(const FilePath& file_path); | |
44 #endif | |
45 | |
46 protected: | 47 protected: |
47 virtual ~URLRequestFileJob(); | 48 virtual ~URLRequestFileJob(); |
48 | 49 |
49 // The OS-specific full path name of the file | 50 // The OS-specific full path name of the file |
50 FilePath file_path_; | 51 FilePath file_path_; |
51 | 52 |
52 private: | 53 private: |
53 void DidResolve(bool exists, const base::PlatformFileInfo& file_info); | 54 void DidResolve(bool exists, const base::PlatformFileInfo& file_info); |
54 void DidRead(int result); | 55 void DidRead(int result); |
55 | 56 |
(...skipping 11 matching lines...) Expand all Loading... |
67 #endif | 68 #endif |
68 | 69 |
69 ScopedRunnableMethodFactory<URLRequestFileJob> method_factory_; | 70 ScopedRunnableMethodFactory<URLRequestFileJob> method_factory_; |
70 | 71 |
71 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); | 72 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); |
72 }; | 73 }; |
73 | 74 |
74 } // namespace net | 75 } // namespace net |
75 | 76 |
76 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 77 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
OLD | NEW |