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 #include "net/url_request/url_request_file_dir_job.h" | 5 #include "net/url_request/url_request_file_dir_job.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 base::SysNativeMBToWide(dir_path_.value())); | 112 base::SysNativeMBToWide(dir_path_.value())); |
113 #endif | 113 #endif |
114 data_.append(GetDirectoryListingHeader(title)); | 114 data_.append(GetDirectoryListingHeader(title)); |
115 wrote_header_ = true; | 115 wrote_header_ = true; |
116 } | 116 } |
117 | 117 |
118 #if defined(OS_WIN) | 118 #if defined(OS_WIN) |
119 std::string raw_bytes; // Empty on Windows means UTF-8 encoded name. | 119 std::string raw_bytes; // Empty on Windows means UTF-8 encoded name. |
120 #elif defined(OS_POSIX) | 120 #elif defined(OS_POSIX) |
121 // TOOD(jungshik): The same issue as for the directory name. | 121 // TOOD(jungshik): The same issue as for the directory name. |
122 const std::string& raw_bytes = data.info.GetName().value(); | 122 base::FilePath filename = data.info.GetName(); |
| 123 const std::string& raw_bytes = filename.value(); |
123 #endif | 124 #endif |
124 data_.append(GetDirectoryListingEntry( | 125 data_.append(GetDirectoryListingEntry( |
125 data.info.GetName().LossyDisplayName(), | 126 data.info.GetName().LossyDisplayName(), |
126 raw_bytes, | 127 raw_bytes, |
127 data.info.IsDirectory(), | 128 data.info.IsDirectory(), |
128 data.info.GetSize(), | 129 data.info.GetSize(), |
129 data.info.GetLastModifiedTime())); | 130 data.info.GetLastModifiedTime())); |
130 | 131 |
131 // TODO(darin): coalesce more? | 132 // TODO(darin): coalesce more? |
132 CompleteRead(); | 133 CompleteRead(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 *bytes_read = count; | 179 *bytes_read = count; |
179 return true; | 180 return true; |
180 } else if (list_complete_) { | 181 } else if (list_complete_) { |
181 // EOF | 182 // EOF |
182 return true; | 183 return true; |
183 } | 184 } |
184 return false; | 185 return false; |
185 } | 186 } |
186 | 187 |
187 } // namespace net | 188 } // namespace net |
OLD | NEW |