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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 // difficult for callers to know how long to keep a reference to this | 406 // difficult for callers to know how long to keep a reference to this |
407 // instance. We AddRef() here to keep the instance alive after we return | 407 // instance. We AddRef() here to keep the instance alive after we return |
408 // to the caller, until the last callback is received from the file dialog. | 408 // to the caller, until the last callback is received from the file dialog. |
409 // At that point, we must call RunFileChooserEnd(). | 409 // At that point, we must call RunFileChooserEnd(). |
410 AddRef(); | 410 AddRef(); |
411 } | 411 } |
412 | 412 |
413 void FileSelectHelper::RunFileChooserOnFileThread( | 413 void FileSelectHelper::RunFileChooserOnFileThread( |
414 const FileChooserParams& params) { | 414 const FileChooserParams& params) { |
415 select_file_types_ = GetFileTypesFromAcceptType(params.accept_types); | 415 select_file_types_ = GetFileTypesFromAcceptType(params.accept_types); |
| 416 select_file_types_->support_drive = !params.need_local_path; |
416 | 417 |
417 BrowserThread::PostTask( | 418 BrowserThread::PostTask( |
418 BrowserThread::UI, FROM_HERE, | 419 BrowserThread::UI, FROM_HERE, |
419 base::Bind(&FileSelectHelper::RunFileChooserOnUIThread, this, params)); | 420 base::Bind(&FileSelectHelper::RunFileChooserOnUIThread, this, params)); |
420 } | 421 } |
421 | 422 |
422 void FileSelectHelper::RunFileChooserOnUIThread( | 423 void FileSelectHelper::RunFileChooserOnUIThread( |
423 const FileChooserParams& params) { | 424 const FileChooserParams& params) { |
424 if (!render_view_host_ || !web_contents_) { | 425 if (!render_view_host_ || !web_contents_) { |
425 // If the renderer was destroyed before we started, just cancel the | 426 // If the renderer was destroyed before we started, just cancel the |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 // of an extension or a "/" in the case of a MIME type). | 561 // of an extension or a "/" in the case of a MIME type). |
561 std::string unused; | 562 std::string unused; |
562 if (accept_type.length() <= 1 || | 563 if (accept_type.length() <= 1 || |
563 base::StringToLowerASCII(accept_type) != accept_type || | 564 base::StringToLowerASCII(accept_type) != accept_type || |
564 base::TrimWhitespaceASCII(accept_type, base::TRIM_ALL, &unused) != | 565 base::TrimWhitespaceASCII(accept_type, base::TRIM_ALL, &unused) != |
565 base::TRIM_NONE) { | 566 base::TRIM_NONE) { |
566 return false; | 567 return false; |
567 } | 568 } |
568 return true; | 569 return true; |
569 } | 570 } |
OLD | NEW |