OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 // URLRequestJob implementation. | 66 // URLRequestJob implementation. |
67 std::unique_ptr<SourceStream> SetUpSourceStream() override; | 67 std::unique_ptr<SourceStream> SetUpSourceStream() override; |
68 | 68 |
69 int64_t remaining_bytes() const { return remaining_bytes_; } | 69 int64_t remaining_bytes() const { return remaining_bytes_; } |
70 | 70 |
71 // The OS-specific full path name of the file | 71 // The OS-specific full path name of the file |
72 base::FilePath file_path_; | 72 base::FilePath file_path_; |
73 | 73 |
74 private: | 74 private: |
| 75 // ... |
| 76 virtual bool CanAccessFile(const base::FilePath& original_path, |
| 77 const base::FilePath& absolute_path); |
| 78 |
75 // Meta information about the file. It's used as a member in the | 79 // Meta information about the file. It's used as a member in the |
76 // URLRequestFileJob and also passed between threads because disk access is | 80 // URLRequestFileJob and also passed between threads because disk access is |
77 // necessary to obtain it. | 81 // necessary to obtain it. |
78 struct FileMetaInfo { | 82 struct FileMetaInfo { |
79 FileMetaInfo(); | 83 FileMetaInfo(); |
80 | 84 |
81 // Size of the file. | 85 // Size of the file. |
82 int64_t file_size; | 86 int64_t file_size; |
83 // Mime type associated with the file. | 87 // Mime type associated with the file. |
84 std::string mime_type; | 88 std::string mime_type; |
85 // Result returned from GetMimeTypeFromFile(), i.e. flag showing whether | 89 // Result returned from GetMimeTypeFromFile(), i.e. flag showing whether |
86 // obtaining of the mime type was successful. | 90 // obtaining of the mime type was successful. |
87 bool mime_type_result; | 91 bool mime_type_result; |
88 // Flag showing whether the file exists. | 92 // Flag showing whether the file exists. |
89 bool file_exists; | 93 bool file_exists; |
90 // Flag showing whether the file name actually refers to a directory. | 94 // Flag showing whether the file name actually refers to a directory. |
91 bool is_directory; | 95 bool is_directory; |
| 96 // Absolute path of the file (i.e. symbolic link is resolved). |
| 97 base::FilePath absolute_path; |
92 }; | 98 }; |
93 | 99 |
94 // Fetches file info on a background thread. | 100 // Fetches file info on a background thread. |
95 static void FetchMetaInfo(const base::FilePath& file_path, | 101 static void FetchMetaInfo(const base::FilePath& file_path, |
96 FileMetaInfo* meta_info); | 102 FileMetaInfo* meta_info); |
97 | 103 |
98 // Callback after fetching file info on a background thread. | 104 // Callback after fetching file info on a background thread. |
99 void DidFetchMetaInfo(const FileMetaInfo* meta_info); | 105 void DidFetchMetaInfo(const FileMetaInfo* meta_info); |
100 | 106 |
101 // Callback after opening file on a background thread. | 107 // Callback after opening file on a background thread. |
(...skipping 17 matching lines...) Expand all Loading... |
119 Error range_parse_result_; | 125 Error range_parse_result_; |
120 | 126 |
121 base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_; | 127 base::WeakPtrFactory<URLRequestFileJob> weak_ptr_factory_; |
122 | 128 |
123 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); | 129 DISALLOW_COPY_AND_ASSIGN(URLRequestFileJob); |
124 }; | 130 }; |
125 | 131 |
126 } // namespace net | 132 } // namespace net |
127 | 133 |
128 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ | 134 #endif // NET_URL_REQUEST_URL_REQUEST_FILE_JOB_H_ |
OLD | NEW |