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/base/directory_lister.h" | 5 #include "net/base/directory_lister.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/i18n/file_util_icu.h" | 12 #include "base/i18n/file_util_icu.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/message_loop/message_loop_proxy.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "base/threading/thread_restrictions.h" | 16 #include "base/threading/thread_restrictions.h" |
17 #include "base/threading/worker_pool.h" | 17 #include "base/threading/worker_pool.h" |
18 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 bool IsDotDot(const base::FilePath& path) { | 24 bool IsDotDot(const base::FilePath& path) { |
25 return FILE_PATH_LITERAL("..") == path.BaseName().value(); | 25 return FILE_PATH_LITERAL("..") == path.BaseName().value(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 void DirectoryLister::Cancel() { | 91 void DirectoryLister::Cancel() { |
92 core_->CancelOnOriginThread(); | 92 core_->CancelOnOriginThread(); |
93 } | 93 } |
94 | 94 |
95 DirectoryLister::Core::Core(const base::FilePath& dir, | 95 DirectoryLister::Core::Core(const base::FilePath& dir, |
96 ListingType type, | 96 ListingType type, |
97 DirectoryLister* lister) | 97 DirectoryLister* lister) |
98 : dir_(dir), | 98 : dir_(dir), |
99 type_(type), | 99 type_(type), |
100 origin_loop_(base::MessageLoopProxy::current()), | 100 origin_loop_(base::ThreadTaskRunnerHandle::Get()), |
101 lister_(lister), | 101 lister_(lister), |
102 cancelled_(0) { | 102 cancelled_(0) { |
103 DCHECK(lister_); | 103 DCHECK(lister_); |
104 } | 104 } |
105 | 105 |
106 DirectoryLister::Core::~Core() {} | 106 DirectoryLister::Core::~Core() {} |
107 | 107 |
108 void DirectoryLister::Core::CancelOnOriginThread() { | 108 void DirectoryLister::Core::CancelOnOriginThread() { |
109 DCHECK(origin_loop_->BelongsToCurrentThread()); | 109 DCHECK(origin_loop_->BelongsToCurrentThread()); |
110 | 110 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 void DirectoryLister::OnListFile(const DirectoryListerData& data) { | 196 void DirectoryLister::OnListFile(const DirectoryListerData& data) { |
197 delegate_->OnListFile(data); | 197 delegate_->OnListFile(data); |
198 } | 198 } |
199 | 199 |
200 void DirectoryLister::OnListDone(int error) { | 200 void DirectoryLister::OnListDone(int error) { |
201 delegate_->OnListDone(error); | 201 delegate_->OnListDone(error); |
202 } | 202 } |
203 | 203 |
204 } // namespace net | 204 } // namespace net |
OLD | NEW |