| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 // Android needs the original MIME types and an additional capture value. | 416 // Android needs the original MIME types and an additional capture value. |
| 417 std::vector<string16> accept_types(params.accept_types); | 417 std::vector<string16> accept_types(params.accept_types); |
| 418 accept_types.push_back(params.capture); | 418 accept_types.push_back(params.capture); |
| 419 #endif | 419 #endif |
| 420 | 420 |
| 421 select_file_dialog_->SelectFile( | 421 select_file_dialog_->SelectFile( |
| 422 dialog_type_, | 422 dialog_type_, |
| 423 params.title, | 423 params.title, |
| 424 default_file_name, | 424 default_file_name, |
| 425 select_file_types_.get(), | 425 select_file_types_.get(), |
| 426 select_file_types_.get() && !select_file_types_->extensions.empty() ? | 426 select_file_types_.get() && !select_file_types_->extensions.empty() |
| 427 1 : 0, // 1-based index of default extension to show. | 427 ? 1 |
| 428 FILE_PATH_LITERAL(""), | 428 : 0, // 1-based index of default extension to show. |
| 429 base::FilePath::StringType(), |
| 429 owning_window, | 430 owning_window, |
| 430 #if defined(OS_ANDROID) | 431 #if defined(OS_ANDROID) |
| 431 &accept_types); | 432 &accept_types); |
| 432 #else | 433 #else |
| 433 NULL); | 434 NULL); |
| 434 #endif | 435 #endif |
| 435 | 436 |
| 436 select_file_types_.reset(); | 437 select_file_types_.reset(); |
| 437 } | 438 } |
| 438 | 439 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 // A 1 character accept type will always be invalid (either a "." in the case | 494 // A 1 character accept type will always be invalid (either a "." in the case |
| 494 // of an extension or a "/" in the case of a MIME type). | 495 // of an extension or a "/" in the case of a MIME type). |
| 495 std::string unused; | 496 std::string unused; |
| 496 if (accept_type.length() <= 1 || | 497 if (accept_type.length() <= 1 || |
| 497 StringToLowerASCII(accept_type) != accept_type || | 498 StringToLowerASCII(accept_type) != accept_type || |
| 498 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { | 499 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { |
| 499 return false; | 500 return false; |
| 500 } | 501 } |
| 501 return true; | 502 return true; |
| 502 } | 503 } |
| OLD | NEW |