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, ""); | |
xhwang
2014/09/25 23:11:11
If this shouldn't happen, add a NOTREACHED so that
qinmin
2014/09/26 18:48:49
Done.
| |
57 return; | |
58 } | |
59 const std::vector<storage::BlobData::Item> items = data->items(); | |
55 | 60 |
56 // TODO(qinmin): handle the case when the blob data is not a single file. | 61 // TODO(qinmin): handle the case when the blob data is not a single file. |
57 DLOG_IF(WARNING, items.size() != 1u) | 62 DLOG_IF(WARNING, items.size() != 1u) |
58 << "More than one blob data are present: " << items.size(); | 63 << "More than one blob data are present: " << items.size(); |
59 ReturnResultOnUIThread(callback, items[0].path().value()); | 64 ReturnResultOnUIThread(callback, items[0].path().value()); |
60 } | 65 } |
61 | 66 |
62 static void RequestPlaformPathFromFileSystemURL( | 67 static void RequestPlaformPathFromFileSystemURL( |
63 const GURL& url, | 68 const GURL& url, |
64 int render_process_id, | 69 int render_process_id, |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
360 FROM_HERE, | 365 FROM_HERE, |
361 base::Bind(&GetMediaMetadataFromFd, fd, offset, size, callback)); | 366 base::Bind(&GetMediaMetadataFromFd, fd, offset, size, callback)); |
362 } | 367 } |
363 | 368 |
364 // static | 369 // static |
365 bool MediaResourceGetterImpl::RegisterMediaResourceGetter(JNIEnv* env) { | 370 bool MediaResourceGetterImpl::RegisterMediaResourceGetter(JNIEnv* env) { |
366 return RegisterNativesImpl(env); | 371 return RegisterNativesImpl(env); |
367 } | 372 } |
368 | 373 |
369 } // namespace content | 374 } // namespace content |
OLD | NEW |