| 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/browser/media/android/media_resource_getter_impl.h" | 5 #include "content/browser/media/android/media_resource_getter_impl.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 static void RequestPlatformPathFromBlobURL( | 45 static void RequestPlatformPathFromBlobURL( |
| 46 const GURL& url, | 46 const GURL& url, |
| 47 BrowserContext* browser_context, | 47 BrowserContext* browser_context, |
| 48 const base::Callback<void(const std::string&)>& callback) { | 48 const base::Callback<void(const std::string&)>& callback) { |
| 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 50 ChromeBlobStorageContext* context = | 50 ChromeBlobStorageContext* context = |
| 51 ChromeBlobStorageContext::GetFor(browser_context); | 51 ChromeBlobStorageContext::GetFor(browser_context); |
| 52 scoped_ptr<storage::BlobDataHandle> handle = | 52 scoped_ptr<storage::BlobDataHandle> handle = |
| 53 context->context()->GetBlobDataFromPublicURL(url); | 53 context->context()->GetBlobDataFromPublicURL(url); |
| 54 const std::vector<storage::BlobData::Item> items = handle->data()->items(); | 54 storage::BlobData* data = handle->data(); |
| 55 if (!data) { |
| 56 ReturnResultOnUIThread(callback, ""); |
| 57 NOTREACHED(); |
| 58 return; |
| 59 } |
| 60 const std::vector<storage::BlobData::Item> items = data->items(); |
| 55 | 61 |
| 56 // TODO(qinmin): handle the case when the blob data is not a single file. | 62 // TODO(qinmin): handle the case when the blob data is not a single file. |
| 57 DLOG_IF(WARNING, items.size() != 1u) | 63 DLOG_IF(WARNING, items.size() != 1u) |
| 58 << "More than one blob data are present: " << items.size(); | 64 << "More than one blob data are present: " << items.size(); |
| 59 ReturnResultOnUIThread(callback, items[0].path().value()); | 65 ReturnResultOnUIThread(callback, items[0].path().value()); |
| 60 } | 66 } |
| 61 | 67 |
| 62 static void RequestPlaformPathFromFileSystemURL( | 68 static void RequestPlaformPathFromFileSystemURL( |
| 63 const GURL& url, | 69 const GURL& url, |
| 64 int render_process_id, | 70 int render_process_id, |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 FROM_HERE, | 366 FROM_HERE, |
| 361 base::Bind(&GetMediaMetadataFromFd, fd, offset, size, callback)); | 367 base::Bind(&GetMediaMetadataFromFd, fd, offset, size, callback)); |
| 362 } | 368 } |
| 363 | 369 |
| 364 // static | 370 // static |
| 365 bool MediaResourceGetterImpl::RegisterMediaResourceGetter(JNIEnv* env) { | 371 bool MediaResourceGetterImpl::RegisterMediaResourceGetter(JNIEnv* env) { |
| 366 return RegisterNativesImpl(env); | 372 return RegisterNativesImpl(env); |
| 367 } | 373 } |
| 368 | 374 |
| 369 } // namespace content | 375 } // namespace content |
| OLD | NEW |