Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: chrome/browser/chromeos/drive/drive_file_system_proxy.cc

Issue 12258021: Fix filesystem API file_handlers to work for drive on ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 } 172 }
173 173
174 void DriveFileSystemProxy::DetachFromFileSystem() { 174 void DriveFileSystemProxy::DetachFromFileSystem() {
175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
176 file_system_ = NULL; 176 file_system_ = NULL;
177 } 177 }
178 178
179 void DriveFileSystemProxy::GetFileInfo(const FileSystemURL& file_url, 179 void DriveFileSystemProxy::GetFileInfo(const FileSystemURL& file_url,
180 const FileSystemOperation::GetMetadataCallback& callback) { 180 const FileSystemOperation::GetMetadataCallback& callback) {
181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
182
182 base::FilePath file_path; 183 base::FilePath file_path;
183 if (!ValidateUrl(file_url, &file_path)) { 184 if (!ValidateUrl(file_url, &file_path)) {
184 MessageLoopProxy::current()->PostTask(FROM_HERE, 185 MessageLoopProxy::current()->PostTask(FROM_HERE,
185 base::Bind(callback, 186 base::Bind(callback,
186 base::PLATFORM_FILE_ERROR_NOT_FOUND, 187 base::PLATFORM_FILE_ERROR_NOT_FOUND,
187 base::PlatformFileInfo(), 188 base::PlatformFileInfo(),
188 base::FilePath())); 189 base::FilePath()));
189 return; 190 return;
190 } 191 }
191 192
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 691 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
691 } 692 }
692 693
693 // static. 694 // static.
694 bool DriveFileSystemProxy::ValidateUrl( 695 bool DriveFileSystemProxy::ValidateUrl(
695 const FileSystemURL& url, base::FilePath* file_path) { 696 const FileSystemURL& url, base::FilePath* file_path) {
696 // what platform you're on. 697 // what platform you're on.
697 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) { 698 if (!url.is_valid() || url.type() != fileapi::kFileSystemTypeDrive) {
698 return false; 699 return false;
699 } 700 }
700 *file_path = url.virtual_path(); 701
701 return true; 702 // |url.virtual_path()| cannot be used directly because in the case the url is
703 // isolated file system url, the virtual path will be formatted as
704 // <isolated_file_system_id>/<file_name> and thus unusable by drive file
705 // system.
706 *file_path = util::ExtractDrivePath(url.path());
707 return !file_path->empty();
702 } 708 }
703 709
704 void DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThread( 710 void DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThread(
705 const base::Closure& method_call) { 711 const base::Closure& method_call) {
706 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 712 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
707 BrowserThread::PostTask( 713 BrowserThread::PostTask(
708 BrowserThread::UI, 714 BrowserThread::UI,
709 FROM_HERE, 715 FROM_HERE,
710 base::Bind( 716 base::Bind(
711 &DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThreadInternal, 717 &DriveFileSystemProxy::CallDriveFileSystemMethodOnUIThreadInternal,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 CallDriveFileSystemMethodOnUIThread( 816 CallDriveFileSystemMethodOnUIThread(
811 base::Bind(&DriveFileSystemInterface::CloseFile, 817 base::Bind(&DriveFileSystemInterface::CloseFile,
812 base::Unretained(file_system_), 818 base::Unretained(file_system_),
813 virtual_path, 819 virtual_path,
814 google_apis::CreateRelayCallback( 820 google_apis::CreateRelayCallback(
815 base::Bind(&EmitDebugLogForCloseFile, 821 base::Bind(&EmitDebugLogForCloseFile,
816 virtual_path)))); 822 virtual_path))));
817 } 823 }
818 824
819 } // namespace drive 825 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698