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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // can catch errors from DirectoryLister and show an error page. | 101 // can catch errors from DirectoryLister and show an error page. |
102 if (!wrote_header_) { | 102 if (!wrote_header_) { |
103 #if defined(OS_WIN) | 103 #if defined(OS_WIN) |
104 const base::string16& title = dir_path_.value(); | 104 const base::string16& title = dir_path_.value(); |
105 #elif defined(OS_POSIX) | 105 #elif defined(OS_POSIX) |
106 // TODO(jungshik): Add SysNativeMBToUTF16 to sys_string_conversions. | 106 // TODO(jungshik): Add SysNativeMBToUTF16 to sys_string_conversions. |
107 // On Mac, need to add NFKC->NFC conversion either here or in file_path. | 107 // On Mac, need to add NFKC->NFC conversion either here or in file_path. |
108 // On Linux, the file system encoding is not defined, but we assume that | 108 // On Linux, the file system encoding is not defined, but we assume that |
109 // SysNativeMBToWide takes care of it at least for now. We can try something | 109 // SysNativeMBToWide takes care of it at least for now. We can try something |
110 // more sophisticated if necessary later. | 110 // more sophisticated if necessary later. |
111 const base::string16& title = WideToUTF16( | 111 const base::string16& title = base::WideToUTF16( |
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. |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 *bytes_read = count; | 179 *bytes_read = count; |
180 return true; | 180 return true; |
181 } else if (list_complete_) { | 181 } else if (list_complete_) { |
182 // EOF | 182 // EOF |
183 return true; | 183 return true; |
184 } | 184 } |
185 return false; | 185 return false; |
186 } | 186 } |
187 | 187 |
188 } // namespace net | 188 } // namespace net |
OLD | NEW |