| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 virtual void SetExtraRequestHeaders( | 46 virtual void SetExtraRequestHeaders( |
| 47 const HttpRequestHeaders& headers) OVERRIDE; | 47 const HttpRequestHeaders& headers) OVERRIDE; |
| 48 | 48 |
| 49 protected: | 49 protected: |
| 50 virtual ~URLRequestFileJob(); | 50 virtual ~URLRequestFileJob(); |
| 51 | 51 |
| 52 // The OS-specific full path name of the file | 52 // The OS-specific full path name of the file |
| 53 FilePath file_path_; | 53 FilePath file_path_; |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 // Tests to see if access to |path| is allowed. If g_allow_file_access_ is |
| 57 // true, then this will return true. If the NetworkDelegate associated with |
| 58 // the |request| says it's OK, then this will also return true. |
| 59 static bool IsFileAccessAllowed(const URLRequest& request, |
| 60 const FilePath& path); |
| 61 |
| 56 // Callback after fetching file info on a background thread. | 62 // Callback after fetching file info on a background thread. |
| 57 void DidResolve(bool exists, const base::PlatformFileInfo& file_info); | 63 void DidResolve(bool exists, const base::PlatformFileInfo& file_info); |
| 58 | 64 |
| 59 // Callback after data is asynchronously read from the file. | 65 // Callback after data is asynchronously read from the file. |
| 60 void DidRead(int result); | 66 void DidRead(int result); |
| 61 | 67 |
| 62 FileStream stream_; | 68 FileStream stream_; |
| 63 bool is_directory_; | 69 bool is_directory_; |
| 64 | 70 |
| 65 HttpByteRange byte_range_; | 71 HttpByteRange byte_range_; |
| 66 int64 remaining_bytes_; | 72 int64 remaining_bytes_; |
| 67 | 73 |
| 68 // The initial file metadata is fetched on a background thread. | 74 // The initial file metadata is fetched on a background thread. |
| 69 // AsyncResolver runs that task. | 75 // AsyncResolver runs that task. |
| 70 class AsyncResolver; | 76 class AsyncResolver; |
| 71 friend class AsyncResolver; | 77 friend class AsyncResolver; |
| 72 scoped_refptr<AsyncResolver> async_resolver_; | 78 scoped_refptr<AsyncResolver> async_resolver_; |
| 73 | 79 |
| 74 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); | 80 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); |
| 75 }; | 81 }; |
| 76 | 82 |
| 77 } // namespace net | 83 } // namespace net |
| 78 | 84 |
| 79 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 85 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
| OLD | NEW |