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 "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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 } | 134 } |
135 | 135 |
136 FileSystemMountPointProvider* FileSystemContext::GetMountPointProvider( | 136 FileSystemMountPointProvider* FileSystemContext::GetMountPointProvider( |
137 FileSystemType type) const { | 137 FileSystemType type) const { |
138 switch (type) { | 138 switch (type) { |
139 case kFileSystemTypeTemporary: | 139 case kFileSystemTypeTemporary: |
140 case kFileSystemTypePersistent: | 140 case kFileSystemTypePersistent: |
141 case kFileSystemTypeSyncable: | 141 case kFileSystemTypeSyncable: |
142 return sandbox_provider_.get(); | 142 return sandbox_provider_.get(); |
143 case kFileSystemTypeExternal: | 143 case kFileSystemTypeExternal: |
| 144 case kFileSystemTypeExternalFullPath: |
144 case kFileSystemTypeDrive: | 145 case kFileSystemTypeDrive: |
145 case kFileSystemTypeRestrictedNativeLocal: | 146 case kFileSystemTypeRestrictedNativeLocal: |
146 return external_provider_.get(); | 147 return external_provider_.get(); |
147 case kFileSystemTypeIsolated: | 148 case kFileSystemTypeIsolated: |
148 case kFileSystemTypeDragged: | 149 case kFileSystemTypeDragged: |
149 case kFileSystemTypeNativeMedia: | 150 case kFileSystemTypeNativeMedia: |
150 case kFileSystemTypeDeviceMedia: | 151 case kFileSystemTypeDeviceMedia: |
151 return isolated_provider_.get(); | 152 return isolated_provider_.get(); |
152 case kFileSystemTypeNativeLocal: | 153 case kFileSystemTypeNativeLocal: |
153 #if defined(OS_CHROMEOS) | 154 #if defined(OS_CHROMEOS) |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 | 345 |
345 FileSystemURL FileSystemContext::CrackFileSystemURL( | 346 FileSystemURL FileSystemContext::CrackFileSystemURL( |
346 const FileSystemURL& url) const { | 347 const FileSystemURL& url) const { |
347 if (!url.is_valid()) | 348 if (!url.is_valid()) |
348 return FileSystemURL(); | 349 return FileSystemURL(); |
349 | 350 |
350 // The returned value in case there is no crackers which can crack the url. | 351 // The returned value in case there is no crackers which can crack the url. |
351 // This is valid situation for non isolated/external file systems. | 352 // This is valid situation for non isolated/external file systems. |
352 FileSystemURL result = url; | 353 FileSystemURL result = url; |
353 | 354 |
354 for (size_t i = 0; i < url_crackers_.size(); ++i) { | 355 bool cracked = true; |
355 if (!url_crackers_[i]->HandlesFileSystemMountType(url.type())) | 356 while (cracked) { |
356 continue; | 357 LOG(ERROR) << "CRACKING: " << result.type() << " " << result.path().value(); |
| 358 cracked = false; |
| 359 for (size_t i = 0; i < url_crackers_.size(); ++i) { |
| 360 if (!url_crackers_[i]->HandlesFileSystemMountType(result.type())) |
| 361 continue; |
357 | 362 |
358 result = url_crackers_[i]->CreateCrackedFileSystemURL(url.origin(), | 363 result = url_crackers_[i]->CrackFileSystemURL(result); |
359 url.type(), | 364 if (result.is_valid()) { |
360 url.path()); | 365 cracked = true; |
361 if (result.is_valid()) | 366 break; |
362 return result; | 367 } |
| 368 } |
363 } | 369 } |
364 | 370 LOG(ERROR) << "RESULT: " << result.type() << " " << result.path().value(); |
365 return result; | 371 return result; |
366 } | 372 } |
367 | 373 |
368 FileSystemFileUtil* FileSystemContext::GetFileUtil( | 374 FileSystemFileUtil* FileSystemContext::GetFileUtil( |
369 FileSystemType type) const { | 375 FileSystemType type) const { |
370 FileSystemMountPointProvider* mount_point_provider = | 376 FileSystemMountPointProvider* mount_point_provider = |
371 GetMountPointProvider(type); | 377 GetMountPointProvider(type); |
372 if (!mount_point_provider) | 378 if (!mount_point_provider) |
373 return NULL; | 379 return NULL; |
374 return mount_point_provider->GetFileUtil(type); | 380 return mount_point_provider->GetFileUtil(type); |
375 } | 381 } |
376 | 382 |
377 } // namespace fileapi | 383 } // namespace fileapi |
OLD | NEW |