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/chromeos/drive/drive_file_system_proxy.h" | 5 #include "chrome/browser/chromeos/drive/drive_file_system_proxy.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 690 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
691 } | 691 } |
692 | 692 |
693 // static. | 693 // static. |
694 bool DriveFileSystemProxy::ValidateUrl( | 694 bool DriveFileSystemProxy::ValidateUrl( |
695 const FileSystemURL& url, base::FilePath* file_path) { | 695 const FileSystemURL& url, base::FilePath* file_path) { |
696 // what platform you're on. | 696 // what platform you're on. |
697 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) { | 697 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) { |
698 return false; | 698 return false; |
699 } | 699 } |
700 *file_path = url.virtual_path(); | 700 |
701 return true; | 701 // |url.virtual_path()| cannot be used directly because in the case the url is |
| 702 // isolated file system url, the virtual path will be formatted as |
| 703 // <isolated_file_system_id>/<file_name> and thus unusable by drive file |
| 704 // system. |
| 705 // TODO(kinaba): fix other uses of virtual_path() as in |
| 706 // https://codereview.chromium.org/12483010/ |
| 707 *file_path = util::ExtractDrivePath(url.path()); |
| 708 return !file_path->empty(); |
702 } | 709 } |
703 | 710 |
704 void DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThread( | 711 void DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThread( |
705 const base::Closure& method_call) { | 712 const base::Closure& method_call) { |
706 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 713 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
707 BrowserThread::PostTask( | 714 BrowserThread::PostTask( |
708 BrowserThread::UI, | 715 BrowserThread::UI, |
709 FROM_HERE, | 716 FROM_HERE, |
710 base::Bind( | 717 base::Bind( |
711 &DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThreadInternal, | 718 &DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThreadInternal, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 CallDriveFileSystemMethodOnUIThread( | 817 CallDriveFileSystemMethodOnUIThread( |
811 base::Bind(&DriveFileSystemInterface::CloseFile, | 818 base::Bind(&DriveFileSystemInterface::CloseFile, |
812 base::Unretained(file_system_), | 819 base::Unretained(file_system_), |
813 virtual_path, | 820 virtual_path, |
814 google_apis::CreateRelayCallback( | 821 google_apis::CreateRelayCallback( |
815 base::Bind(&EmitDebugLogForCloseFile, | 822 base::Bind(&EmitDebugLogForCloseFile, |
816 virtual_path)))); | 823 virtual_path)))); |
817 } | 824 } |
818 | 825 |
819 } // namespace drive | 826 } // namespace drive |
OLD | NEW |