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 "chrome/browser/file_select_helper.h" | 5 #include "chrome/browser/file_select_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 void FileSelectHelper::FileSelectionCanceled(void* params) { | 184 void FileSelectHelper::FileSelectionCanceled(void* params) { |
185 NotifyRenderViewHostAndEnd(std::vector<ui::SelectedFileInfo>()); | 185 NotifyRenderViewHostAndEnd(std::vector<ui::SelectedFileInfo>()); |
186 } | 186 } |
187 | 187 |
188 void FileSelectHelper::StartNewEnumeration(const base::FilePath& path, | 188 void FileSelectHelper::StartNewEnumeration(const base::FilePath& path, |
189 int request_id, | 189 int request_id, |
190 RenderViewHost* render_view_host) { | 190 RenderViewHost* render_view_host) { |
191 scoped_ptr<ActiveDirectoryEnumeration> entry(new ActiveDirectoryEnumeration); | 191 scoped_ptr<ActiveDirectoryEnumeration> entry(new ActiveDirectoryEnumeration); |
192 entry->rvh_ = render_view_host; | 192 entry->rvh_ = render_view_host; |
193 entry->delegate_.reset(new DirectoryListerDispatchDelegate(this, request_id)); | 193 entry->delegate_.reset(new DirectoryListerDispatchDelegate(this, request_id)); |
194 entry->lister_.reset(new net::DirectoryLister(path, | 194 entry->lister_.reset(new net::DirectoryLister( |
195 true, | 195 path, net::DirectoryLister::NO_SORT_RECURSIVE, entry->delegate_.get())); |
196 net::DirectoryLister::NO_SORT, | |
197 entry->delegate_.get())); | |
198 if (!entry->lister_->Start()) { | 196 if (!entry->lister_->Start()) { |
199 if (request_id == kFileSelectEnumerationId) | 197 if (request_id == kFileSelectEnumerationId) |
200 FileSelectionCanceled(NULL); | 198 FileSelectionCanceled(NULL); |
201 else | 199 else |
202 render_view_host->DirectoryEnumerationFinished(request_id, | 200 render_view_host->DirectoryEnumerationFinished(request_id, |
203 entry->results_); | 201 entry->results_); |
204 } else { | 202 } else { |
205 directory_enumerations_[request_id] = entry.release(); | 203 directory_enumerations_[request_id] = entry.release(); |
206 } | 204 } |
207 } | 205 } |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 // of an extension or a "/" in the case of a MIME type). | 564 // of an extension or a "/" in the case of a MIME type). |
567 std::string unused; | 565 std::string unused; |
568 if (accept_type.length() <= 1 || | 566 if (accept_type.length() <= 1 || |
569 base::StringToLowerASCII(accept_type) != accept_type || | 567 base::StringToLowerASCII(accept_type) != accept_type || |
570 base::TrimWhitespaceASCII(accept_type, base::TRIM_ALL, &unused) != | 568 base::TrimWhitespaceASCII(accept_type, base::TRIM_ALL, &unused) != |
571 base::TRIM_NONE) { | 569 base::TRIM_NONE) { |
572 return false; | 570 return false; |
573 } | 571 } |
574 return true; | 572 return true; |
575 } | 573 } |
OLD | NEW |