| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/child/webblobregistry_impl.h" | 5 #include "content/child/webblobregistry_impl.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/guid.h" | 8 #include "base/guid.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 switch (data_item.type) { | 50 switch (data_item.type) { |
| 51 case WebBlobData::Item::TypeData: { | 51 case WebBlobData::Item::TypeData: { |
| 52 // WebBlobData does not allow partial data items. | 52 // WebBlobData does not allow partial data items. |
| 53 DCHECK(!data_item.offset && data_item.length == -1); | 53 DCHECK(!data_item.offset && data_item.length == -1); |
| 54 SendDataForBlob(uuid_str, data_item.data); | 54 SendDataForBlob(uuid_str, data_item.data); |
| 55 break; | 55 break; |
| 56 } | 56 } |
| 57 case WebBlobData::Item::TypeFile: | 57 case WebBlobData::Item::TypeFile: |
| 58 if (data_item.length) { | 58 if (data_item.length) { |
| 59 webkit_blob::BlobData::Item item; | 59 webkit_blob::BlobData::Item item; |
| 60 #if defined(OS_ANDROID) |
| 61 GURL content_url = GURL(data_item.filePath); |
| 62 if (content_url.SchemeIsContent()) { |
| 63 item.SetToContentUrlRange( |
| 64 content_url, |
| 65 static_cast<uint64>(data_item.offset), |
| 66 static_cast<uint64>(data_item.length), |
| 67 base::Time::FromDoubleT(data_item.expectedModificationTime)); |
| 68 } else { |
| 69 #endif |
| 60 item.SetToFilePathRange( | 70 item.SetToFilePathRange( |
| 61 base::FilePath::FromUTF16Unsafe(data_item.filePath), | 71 base::FilePath::FromUTF16Unsafe(data_item.filePath), |
| 62 static_cast<uint64>(data_item.offset), | 72 static_cast<uint64>(data_item.offset), |
| 63 static_cast<uint64>(data_item.length), | 73 static_cast<uint64>(data_item.length), |
| 64 base::Time::FromDoubleT(data_item.expectedModificationTime)); | 74 base::Time::FromDoubleT(data_item.expectedModificationTime)); |
| 75 #if defined(OS_ANDROID) |
| 76 } |
| 77 #endif |
| 65 sender_->Send( | 78 sender_->Send( |
| 66 new BlobHostMsg_AppendBlobDataItem(uuid_str, item)); | 79 new BlobHostMsg_AppendBlobDataItem(uuid_str, item)); |
| 67 } | 80 } |
| 68 break; | 81 break; |
| 69 case WebBlobData::Item::TypeBlob: | 82 case WebBlobData::Item::TypeBlob: |
| 70 if (data_item.length) { | 83 if (data_item.length) { |
| 71 webkit_blob::BlobData::Item item; | 84 webkit_blob::BlobData::Item item; |
| 72 item.SetToBlobRange( | 85 item.SetToBlobRange( |
| 73 data_item.blobUUID.utf8(), | 86 data_item.blobUUID.utf8(), |
| 74 static_cast<uint64>(data_item.offset), | 87 static_cast<uint64>(data_item.offset), |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 DCHECK(ChildThread::current()); | 216 DCHECK(ChildThread::current()); |
| 204 sender_->Send(new StreamHostMsg_AbortBuilding(url)); | 217 sender_->Send(new StreamHostMsg_AbortBuilding(url)); |
| 205 } | 218 } |
| 206 | 219 |
| 207 void WebBlobRegistryImpl::unregisterStreamURL(const WebURL& url) { | 220 void WebBlobRegistryImpl::unregisterStreamURL(const WebURL& url) { |
| 208 DCHECK(ChildThread::current()); | 221 DCHECK(ChildThread::current()); |
| 209 sender_->Send(new StreamHostMsg_Remove(url)); | 222 sender_->Send(new StreamHostMsg_Remove(url)); |
| 210 } | 223 } |
| 211 | 224 |
| 212 } // namespace content | 225 } // namespace content |
| OLD | NEW |