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_util.h" | 5 #include "webkit/fileapi/file_system_util.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 return WebKit::WebFileErrorSecurity; | 284 return WebKit::WebFileErrorSecurity; |
285 case base::PLATFORM_FILE_ERROR_NO_SPACE: | 285 case base::PLATFORM_FILE_ERROR_NO_SPACE: |
286 return WebKit::WebFileErrorQuotaExceeded; | 286 return WebKit::WebFileErrorQuotaExceeded; |
287 default: | 287 default: |
288 return WebKit::WebFileErrorInvalidModification; | 288 return WebKit::WebFileErrorInvalidModification; |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
292 bool GetFileSystemPublicType( | 292 bool GetFileSystemPublicType( |
293 const std::string type_string, | 293 const std::string type_string, |
294 WebKit::WebFileSystem::Type* type) { | 294 #ifdef WEBKIT_USE_NEW_WEBFILESYSTEMTYPE |
| 295 WebKit::WebFileSystemType* type |
| 296 #else |
| 297 WebKit::WebFileSystem::Type* type |
| 298 #endif |
| 299 ) { |
295 DCHECK(type); | 300 DCHECK(type); |
296 if (type_string == "Temporary") { | 301 if (type_string == "Temporary") { |
| 302 #ifdef WEBKIT_USE_NEW_WEBFILESYSTEMTYPE |
| 303 *type = WebKit::WebFileSystemTypeTemporary; |
| 304 #else |
297 *type = WebKit::WebFileSystem::TypeTemporary; | 305 *type = WebKit::WebFileSystem::TypeTemporary; |
| 306 #endif |
298 return true; | 307 return true; |
299 } | 308 } |
300 if (type_string == "Persistent") { | 309 if (type_string == "Persistent") { |
| 310 #ifdef WEBKIT_USE_NEW_WEBFILESYSTEMTYPE |
| 311 *type = WebKit::WebFileSystemTypePersistent; |
| 312 #else |
301 *type = WebKit::WebFileSystem::TypePersistent; | 313 *type = WebKit::WebFileSystem::TypePersistent; |
| 314 #endif |
302 return true; | 315 return true; |
303 } | 316 } |
304 if (type_string == "Isolated") { | 317 if (type_string == "Isolated") { |
| 318 #ifdef WEBKIT_USE_NEW_WEBFILESYSTEMTYPE |
| 319 *type = WebKit::WebFileSystemTypeIsolated; |
| 320 #else |
305 *type = WebKit::WebFileSystem::TypeIsolated; | 321 *type = WebKit::WebFileSystem::TypeIsolated; |
| 322 #endif |
306 return true; | 323 return true; |
307 } | 324 } |
308 if (type_string == "External") { | 325 if (type_string == "External") { |
| 326 #ifdef WEBKIT_USE_NEW_WEBFILESYSTEMTYPE |
| 327 *type = WebKit::WebFileSystemTypeExternal; |
| 328 #else |
309 *type = WebKit::WebFileSystem::TypeExternal; | 329 *type = WebKit::WebFileSystem::TypeExternal; |
| 330 #endif |
310 return true; | 331 return true; |
311 } | 332 } |
312 NOTREACHED(); | 333 NOTREACHED(); |
313 return false; | 334 return false; |
314 } | 335 } |
315 | 336 |
316 std::string GetIsolatedFileSystemName(const GURL& origin_url, | 337 std::string GetIsolatedFileSystemName(const GURL& origin_url, |
317 const std::string& filesystem_id) { | 338 const std::string& filesystem_id) { |
318 std::string name(fileapi::GetFileSystemName(origin_url, | 339 std::string name(fileapi::GetFileSystemName(origin_url, |
319 fileapi::kFileSystemTypeIsolated)); | 340 fileapi::kFileSystemTypeIsolated)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 root.append("/"); | 385 root.append("/"); |
365 } | 386 } |
366 return root; | 387 return root; |
367 } | 388 } |
368 | 389 |
369 bool AreSameFileSystem(const FileSystemURL& url1, const FileSystemURL& url2) { | 390 bool AreSameFileSystem(const FileSystemURL& url1, const FileSystemURL& url2) { |
370 return url1.origin() == url2.origin() && url1.type() == url2.type(); | 391 return url1.origin() == url2.origin() && url1.type() == url2.type(); |
371 } | 392 } |
372 | 393 |
373 } // namespace fileapi | 394 } // namespace fileapi |
OLD | NEW |