| 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 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 | 400 |
| 401 select_file_dialog_->SelectFile( | 401 select_file_dialog_->SelectFile( |
| 402 dialog_type_, | 402 dialog_type_, |
| 403 params.title, | 403 params.title, |
| 404 default_file_name, | 404 default_file_name, |
| 405 select_file_types_.get(), | 405 select_file_types_.get(), |
| 406 select_file_types_.get() ? 1 : 0, // 1-based index. | 406 select_file_types_.get() ? 1 : 0, // 1-based index. |
| 407 FILE_PATH_LITERAL(""), | 407 FILE_PATH_LITERAL(""), |
| 408 web_contents_, | 408 web_contents_, |
| 409 owning_window, | 409 owning_window, |
| 410 #if defined(OS_ANDROID) |
| 411 const_cast<content::FileChooserParams*>(¶ms); |
| 412 #else |
| 410 NULL); | 413 NULL); |
| 414 #endif |
| 411 | 415 |
| 412 select_file_types_.reset(); | 416 select_file_types_.reset(); |
| 413 } | 417 } |
| 414 | 418 |
| 415 // This method is called when we receive the last callback from the file | 419 // This method is called when we receive the last callback from the file |
| 416 // chooser dialog. Perform any cleanup and release the reference we added | 420 // chooser dialog. Perform any cleanup and release the reference we added |
| 417 // in RunFileChooser(). | 421 // in RunFileChooser(). |
| 418 void FileSelectHelper::RunFileChooserEnd() { | 422 void FileSelectHelper::RunFileChooserEnd() { |
| 419 render_view_host_ = NULL; | 423 render_view_host_ = NULL; |
| 420 web_contents_ = NULL; | 424 web_contents_ = NULL; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 // A 1 character accept type will always be invalid (either a "." in the case | 473 // A 1 character accept type will always be invalid (either a "." in the case |
| 470 // of an extension or a "/" in the case of a MIME type). | 474 // of an extension or a "/" in the case of a MIME type). |
| 471 std::string unused; | 475 std::string unused; |
| 472 if (accept_type.length() <= 1 || | 476 if (accept_type.length() <= 1 || |
| 473 StringToLowerASCII(accept_type) != accept_type || | 477 StringToLowerASCII(accept_type) != accept_type || |
| 474 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { | 478 TrimWhitespaceASCII(accept_type, TRIM_ALL, &unused) != TRIM_NONE) { |
| 475 return false; | 479 return false; |
| 476 } | 480 } |
| 477 return true; | 481 return true; |
| 478 } | 482 } |
| OLD | NEW |