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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_file_system_proxy.cc

Issue 9742002: Wired GDataFileSystem::GetFile() method with internal cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 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/gdata/gdata_file_system_proxy.h" 5 #include "chrome/browser/chromeos/gdata/gdata_file_system_proxy.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/platform_file.h" 10 #include "base/platform_file.h"
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 } 183 }
184 184
185 file_system_->CreateDirectory(file_path, exclusive, recursive, callback); 185 file_system_->CreateDirectory(file_path, exclusive, recursive, callback);
186 } 186 }
187 187
188 void GDataFileSystemProxy::CreateSnapshotFile( 188 void GDataFileSystemProxy::CreateSnapshotFile(
189 const GURL& file_url, 189 const GURL& file_url,
190 const FileSystemOperationInterface::SnapshotFileCallback& callback) { 190 const FileSystemOperationInterface::SnapshotFileCallback& callback) {
191 FilePath file_path; 191 FilePath file_path;
192 base::PlatformFileInfo file_info; 192 base::PlatformFileInfo file_info;
193 GDataFileProperties file_properties;
193 if (!ValidateUrl(file_url, &file_path) || 194 if (!ValidateUrl(file_url, &file_path) ||
194 !file_system_->GetFileInfoFromPath(file_path, &file_info)) { 195 !file_system_->GetFileInfoFromPath(file_path, &file_properties)) {
195 MessageLoopProxy::current()->PostTask(FROM_HERE, 196 MessageLoopProxy::current()->PostTask(FROM_HERE,
196 base::Bind(callback, 197 base::Bind(callback,
197 base::PLATFORM_FILE_ERROR_NOT_FOUND, 198 base::PLATFORM_FILE_ERROR_NOT_FOUND,
198 base::PlatformFileInfo(), 199 base::PlatformFileInfo(),
199 FilePath(), 200 FilePath(),
200 scoped_refptr<ShareableFileReference>(NULL))); 201 scoped_refptr<ShareableFileReference>(NULL)));
201 return; 202 return;
202 } 203 }
203 204
204 file_system_->GetFile(file_path, 205 file_system_->GetFile(file_path,
205 base::Bind(&CallSnapshotFileCallback, 206 base::Bind(&CallSnapshotFileCallback,
206 callback, 207 callback,
207 file_info)); 208 file_properties.file_info));
208 } 209 }
209 210
210 // static. 211 // static.
211 bool GDataFileSystemProxy::ValidateUrl(const GURL& url, FilePath* file_path) { 212 bool GDataFileSystemProxy::ValidateUrl(const GURL& url, FilePath* file_path) {
212 // what platform you're on. 213 // what platform you're on.
213 FilePath raw_path; 214 FilePath raw_path;
214 fileapi::FileSystemType type = fileapi::kFileSystemTypeUnknown; 215 fileapi::FileSystemType type = fileapi::kFileSystemTypeUnknown;
215 if (!fileapi::CrackFileSystemURL(url, NULL, &type, file_path) || 216 if (!fileapi::CrackFileSystemURL(url, NULL, &type, file_path) ||
216 type != fileapi::kFileSystemTypeExternal) { 217 type != fileapi::kFileSystemTypeExternal) {
217 return false; 218 return false;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 } 271 }
271 272
272 proxy->PostTask(FROM_HERE, 273 proxy->PostTask(FROM_HERE,
273 base::Bind(callback, 274 base::Bind(callback,
274 base::PLATFORM_FILE_OK, 275 base::PLATFORM_FILE_OK,
275 entries, 276 entries,
276 false)); 277 false));
277 } 278 }
278 279
279 } // namespace gdata 280 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_file_system.cc ('k') | chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698