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

Side by Side Diff: webkit/fileapi/file_system_context.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 "webkit/fileapi/file_system_context.h" 5 #include "webkit/fileapi/file_system_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 FileSystemURL result = url; 352 FileSystemURL result = url;
353 353
354 for (size_t i = 0; i < url_crackers_.size(); ++i) { 354 for (size_t i = 0; i < url_crackers_.size(); ++i) {
355 if (!url_crackers_[i]->HandlesFileSystemMountType(url.type())) 355 if (!url_crackers_[i]->HandlesFileSystemMountType(url.type()))
356 continue; 356 continue;
357 357
358 result = url_crackers_[i]->CreateCrackedFileSystemURL(url.origin(), 358 result = url_crackers_[i]->CreateCrackedFileSystemURL(url.origin(),
359 url.type(), 359 url.type(),
360 url.path()); 360 url.path());
361 if (result.is_valid()) 361 if (result.is_valid())
362 return result; 362 break;
363 } 363 }
364 364
365 FileSystemType underlying_mount_type = GetUnderlyingMountType(result);
366 if (underlying_mount_type != fileapi::kFileSystemTypeUnknown) {
367 base::FilePath underlying_virtual_path;
368 if (GetVirtualPath(underlying_mount_type, result.path(),
369 &underlying_virtual_path)) {
370 // Note the recursion.
371 FileSystemURL underlying_url =
372 CreateCrackedFileSystemURL(result.origin(),
373 underlying_mount_type,
374 underlying_virtual_path);
375 if (underlying_url.is_valid()) {
376 result.SetUnderlyingURL(underlying_url);
377 }
378 }
379 }
365 return result; 380 return result;
366 } 381 }
367 382
383 FileSystemType FileSystemContext::GetUnderlyingMountType(
384 const FileSystemURL& url) const {
385 if (external_provider() &&
386 url.is_valid() &&
387 url.type() == fileapi::kFileSystemTypeNativeLocal &&
388 url.mount_type() == fileapi::kFileSystemTypeIsolated) {
389 return kFileSystemTypeExternal;
390 }
391 return kFileSystemTypeUnknown;
392
393 }
394
395 bool FileSystemContext::GetVirtualPath(
396 FileSystemType mount_type,
397 const base::FilePath& full_path,
398 base::FilePath* virtual_path) const {
399 DCHECK(virtual_path);
400
401 for (size_t i = 0; i < url_crackers_.size(); ++i) {
402 if (!url_crackers_[i]->HandlesFileSystemMountType(mount_type))
403 continue;
404
405 if (url_crackers_[i]->GetVirtualPath(full_path, virtual_path))
406 return true;
407 }
408
409 return false;
410 }
411
368 FileSystemFileUtil* FileSystemContext::GetFileUtil( 412 FileSystemFileUtil* FileSystemContext::GetFileUtil(
369 FileSystemType type) const { 413 fileapi::FileSystemType type) const {
370 FileSystemMountPointProvider* mount_point_provider = 414 FileSystemMountPointProvider* mount_point_provider =
371 GetMountPointProvider(type); 415 GetMountPointProvider(type);
372 if (!mount_point_provider) 416 if (!mount_point_provider)
373 return NULL; 417 return NULL;
374 return mount_point_provider->GetFileUtil(type); 418 return mount_point_provider->GetFileUtil(type);
375 } 419 }
376 420
377 } // namespace fileapi 421 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698