| 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/tools/test_shell/simple_file_system.h" | 5 #include "webkit/tools/test_shell/simple_file_system.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 FilePath::StringType extension = file_path.Extension(); | 59 FilePath::StringType extension = file_path.Extension(); |
| 60 if (!extension.empty()) | 60 if (!extension.empty()) |
| 61 extension = extension.substr(1); // Strip leading ".". | 61 extension = extension.substr(1); // Strip leading ".". |
| 62 | 62 |
| 63 // This may fail, but then we'll be just setting the empty mime type. | 63 // This may fail, but then we'll be just setting the empty mime type. |
| 64 std::string mime_type; | 64 std::string mime_type; |
| 65 net::GetWellKnownMimeTypeFromExtension(extension, &mime_type); | 65 net::GetWellKnownMimeTypeFromExtension(extension, &mime_type); |
| 66 | 66 |
| 67 BlobData::Item item; | 67 BlobData::Item item; |
| 68 item.SetToFile(file_path, 0, -1, base::Time()); | 68 item.SetToFilePathRange(file_path, 0, -1, base::Time()); |
| 69 g_blob_storage_controller->StartBuildingBlob(blob_url); | 69 g_blob_storage_controller->StartBuildingBlob(blob_url); |
| 70 g_blob_storage_controller->AppendBlobDataItem(blob_url, item); | 70 g_blob_storage_controller->AppendBlobDataItem(blob_url, item); |
| 71 g_blob_storage_controller->FinishBuildingBlob(blob_url, mime_type); | 71 g_blob_storage_controller->FinishBuildingBlob(blob_url, mime_type); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 SimpleFileSystem::SimpleFileSystem() { | 76 SimpleFileSystem::SimpleFileSystem() { |
| 77 if (file_system_dir_.CreateUniqueTempDir()) { | 77 if (file_system_dir_.CreateUniqueTempDir()) { |
| 78 file_system_context_ = new FileSystemContext( | 78 file_system_context_ = new FileSystemContext( |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 const FilePath& platform_path, | 389 const FilePath& platform_path, |
| 390 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 390 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { |
| 391 DCHECK(g_io_thread); | 391 DCHECK(g_io_thread); |
| 392 if (result == base::PLATFORM_FILE_OK) { | 392 if (result == base::PLATFORM_FILE_OK) { |
| 393 g_io_thread->PostTask( | 393 g_io_thread->PostTask( |
| 394 FROM_HERE, | 394 FROM_HERE, |
| 395 base::Bind(&RegisterBlob, blob_url, platform_path)); | 395 base::Bind(&RegisterBlob, blob_url, platform_path)); |
| 396 } | 396 } |
| 397 DidGetMetadata(callbacks, result, info, platform_path); | 397 DidGetMetadata(callbacks, result, info, platform_path); |
| 398 } | 398 } |
| OLD | NEW |