OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/base/directory_lister.h" | 5 #include "net/base/directory_lister.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/platform_thread.h" | 9 #include "base/platform_thread.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void DirectoryLister::ThreadMain() { | 77 void DirectoryLister::ThreadMain() { |
78 DirectoryDataEvent* e = new DirectoryDataEvent(this); | 78 DirectoryDataEvent* e = new DirectoryDataEvent(this); |
79 | 79 |
80 if (!file_util::DirectoryExists(dir_)) { | 80 if (!file_util::DirectoryExists(dir_)) { |
81 e->error = net::ERR_FILE_NOT_FOUND; | 81 e->error = net::ERR_FILE_NOT_FOUND; |
82 message_loop_->PostTask(FROM_HERE, e); | 82 message_loop_->PostTask(FROM_HERE, e); |
83 Release(); | 83 Release(); |
84 return; | 84 return; |
85 } | 85 } |
86 | 86 |
87 file_util::FileEnumerator file_enum(dir_.ToWStringHack(), false, | 87 file_util::FileEnumerator file_enum(dir_, false, |
88 file_util::FileEnumerator::FILES_AND_DIRECTORIES); | 88 file_util::FileEnumerator::FILES_AND_DIRECTORIES); |
89 | 89 |
90 while (!canceled_ && !(file_enum.Next().empty())) { | 90 while (!canceled_ && !(file_enum.Next().value().empty())) { |
91 file_enum.GetFindInfo(&e->data[e->count]); | 91 file_enum.GetFindInfo(&e->data[e->count]); |
92 | 92 |
93 if (++e->count == kFilesPerEvent) { | 93 if (++e->count == kFilesPerEvent) { |
94 message_loop_->PostTask(FROM_HERE, e); | 94 message_loop_->PostTask(FROM_HERE, e); |
95 e = new DirectoryDataEvent(this); | 95 e = new DirectoryDataEvent(this); |
96 } | 96 } |
97 } | 97 } |
98 | 98 |
99 if (e->count > 0) { | 99 if (e->count > 0) { |
100 message_loop_->PostTask(FROM_HERE, e); | 100 message_loop_->PostTask(FROM_HERE, e); |
(...skipping 20 matching lines...) Expand all Loading... |
121 // error condition if it is already set. | 121 // error condition if it is already set. |
122 if (!error && canceled_) | 122 if (!error && canceled_) |
123 error = net::ERR_ABORTED; | 123 error = net::ERR_ABORTED; |
124 | 124 |
125 if (delegate_) | 125 if (delegate_) |
126 delegate_->OnListDone(error); | 126 delegate_->OnListDone(error); |
127 } | 127 } |
128 | 128 |
129 } // namespace net | 129 } // namespace net |
130 | 130 |
OLD | NEW |