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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 } | 685 } |
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 *file_path = util::ExtractDrivePathFromFileSystemUrl(url); |
696 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) | |
697 return false; | |
698 | |
699 // |url.virtual_path()| cannot be used directly because in the case the url is | |
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(); | 696 return !file_path->empty(); |
707 } | 697 } |
708 | 698 |
709 void DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThread( | 699 void DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThread( |
710 const base::Closure& method_call) { | 700 const base::Closure& method_call) { |
711 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 701 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
712 BrowserThread::PostTask( | 702 BrowserThread::PostTask( |
713 BrowserThread::UI, | 703 BrowserThread::UI, |
714 FROM_HERE, | 704 FROM_HERE, |
715 base::Bind( | 705 base::Bind( |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 CallDriveFileSystemMethodOnUIThread( | 805 CallDriveFileSystemMethodOnUIThread( |
816 base::Bind(&DriveFileSystemInterface::CloseFile, | 806 base::Bind(&DriveFileSystemInterface::CloseFile, |
817 base::Unretained(file_system_), | 807 base::Unretained(file_system_), |
818 virtual_path, | 808 virtual_path, |
819 google_apis::CreateRelayCallback( | 809 google_apis::CreateRelayCallback( |
820 base::Bind(&EmitDebugLogForCloseFile, | 810 base::Bind(&EmitDebugLogForCloseFile, |
821 virtual_path)))); | 811 virtual_path)))); |
822 } | 812 } |
823 | 813 |
824 } // namespace drive | 814 } // namespace drive |
OLD | NEW |