| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 entry->rvh_->DirectoryEnumerationFinished(id, entry->results_); | 228 entry->rvh_->DirectoryEnumerationFinished(id, entry->results_); |
| 229 | 229 |
| 230 EnumerateDirectoryEnd(); | 230 EnumerateDirectoryEnd(); |
| 231 } | 231 } |
| 232 | 232 |
| 233 scoped_ptr<ui::SelectFileDialog::FileTypeInfo> | 233 scoped_ptr<ui::SelectFileDialog::FileTypeInfo> |
| 234 FileSelectHelper::GetFileTypesFromAcceptType( | 234 FileSelectHelper::GetFileTypesFromAcceptType( |
| 235 const std::vector<string16>& accept_types) { | 235 const std::vector<string16>& accept_types) { |
| 236 scoped_ptr<ui::SelectFileDialog::FileTypeInfo> base_file_type( | 236 scoped_ptr<ui::SelectFileDialog::FileTypeInfo> base_file_type( |
| 237 new ui::SelectFileDialog::FileTypeInfo()); | 237 new ui::SelectFileDialog::FileTypeInfo()); |
| 238 base_file_type->support_drive = true; | |
| 239 if (accept_types.empty()) | 238 if (accept_types.empty()) |
| 240 return base_file_type.Pass(); | 239 return base_file_type.Pass(); |
| 241 | 240 |
| 242 // Create FileTypeInfo and pre-allocate for the first extension list. | 241 // Create FileTypeInfo and pre-allocate for the first extension list. |
| 243 scoped_ptr<ui::SelectFileDialog::FileTypeInfo> file_type( | 242 scoped_ptr<ui::SelectFileDialog::FileTypeInfo> file_type( |
| 244 new ui::SelectFileDialog::FileTypeInfo(*base_file_type)); | 243 new ui::SelectFileDialog::FileTypeInfo(*base_file_type)); |
| 245 file_type->include_all_files = true; | 244 file_type->include_all_files = true; |
| 246 file_type->extensions.resize(1); | 245 file_type->extensions.resize(1); |
| 247 std::vector<base::FilePath::StringType>* extensions = | 246 std::vector<base::FilePath::StringType>* extensions = |
| 248 &file_type->extensions.back(); | 247 &file_type->extensions.back(); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 // A 1 character accept type will always be invalid (either a "." in the case | 477 // A 1 character accept type will always be invalid (either a "." in the case |
| 479 // of an extension or a "/" in the case of a MIME type). | 478 // of an extension or a "/" in the case of a MIME type). |
| 480 std::string unused; | 479 std::string unused; |
| 481 if (accept_type.length() <= 1 || | 480 if (accept_type.length() <= 1 || |
| 482 StringToLowerASCII(accept_type) != accept_type || | 481 StringToLowerASCII(accept_type) != accept_type || |
| 483 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { | 482 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { |
| 484 return false; | 483 return false; |
| 485 } | 484 } |
| 486 return true; | 485 return true; |
| 487 } | 486 } |
| OLD | NEW |