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