Chromium Code Reviews| 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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 } |
|
kinuko
2013/03/19 20:34:50
nit: can you drop { } for this one line body while
kinaba
2013/03/21 07:35:13
Done.
| |
| 699 *file_path = url.virtual_path(); | 699 |
| 700 return true; | 700 // |url.virtual_path()| cannot be used directly because in the case the url is |
| 701 // isolated file system url, the virtual path will be formatted as | |
| 702 // <isolated_file_system_id>/<file_name> and thus unusable by drive file | |
| 703 // system. | |
| 704 // TODO(kinaba): fix other uses of virtual_path() as in | |
| 705 // https://codereview.chromium.org/12483010/ | |
| 706 *file_path = util::ExtractDrivePath(url.path()); | |
| 707 return !file_path->empty(); | |
| 701 } | 708 } |
| 702 | 709 |
| 703 void DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThread( | 710 void DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThread( |
| 704 const base::Closure& method_call) { | 711 const base::Closure& method_call) { |
| 705 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 712 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 706 BrowserThread::PostTask( | 713 BrowserThread::PostTask( |
| 707 BrowserThread::UI, | 714 BrowserThread::UI, |
| 708 FROM_HERE, | 715 FROM_HERE, |
| 709 base::Bind( | 716 base::Bind( |
| 710 &DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThreadInternal, | 717 &DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThreadInternal, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 809 CallDriveFileSystemMethodOnUIThread( | 816 CallDriveFileSystemMethodOnUIThread( |
| 810 base::Bind(&DriveFileSystemInterface::CloseFile, | 817 base::Bind(&DriveFileSystemInterface::CloseFile, |
| 811 base::Unretained(file_system_), | 818 base::Unretained(file_system_), |
| 812 virtual_path, | 819 virtual_path, |
| 813 google_apis::CreateRelayCallback( | 820 google_apis::CreateRelayCallback( |
| 814 base::Bind(&EmitDebugLogForCloseFile, | 821 base::Bind(&EmitDebugLogForCloseFile, |
| 815 virtual_path)))); | 822 virtual_path)))); |
| 816 } | 823 } |
| 817 | 824 |
| 818 } // namespace drive | 825 } // namespace drive |
| OLD | NEW |