| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "storage/browser/blob/blob_url_request_job_factory.h" | 5 #include "storage/browser/blob/blob_url_request_job_factory.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "net/base/request_priority.h" | 9 #include "net/base/request_priority.h" |
| 10 #include "net/url_request/url_request_context.h" | 10 #include "net/url_request/url_request_context.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 BlobDataHandle* blob_data_handle = GetRequestedBlobDataHandle(request); | 71 BlobDataHandle* blob_data_handle = GetRequestedBlobDataHandle(request); |
| 72 if (blob_data_handle) | 72 if (blob_data_handle) |
| 73 return blob_data_handle->CreateSnapshot().Pass(); | 73 return blob_data_handle->CreateSnapshot().Pass(); |
| 74 if (!context_.get()) | 74 if (!context_.get()) |
| 75 return NULL; | 75 return NULL; |
| 76 | 76 |
| 77 // Support looking up based on uuid, the FeedbackExtensionAPI relies on this. | 77 // Support looking up based on uuid, the FeedbackExtensionAPI relies on this. |
| 78 // TODO(michaeln): Replace this use case and others like it with a BlobReader | 78 // TODO(michaeln): Replace this use case and others like it with a BlobReader |
| 79 // impl that does not depend on urlfetching to perform this function. | 79 // impl that does not depend on urlfetching to perform this function. |
| 80 const std::string kPrefix("blob:uuid/"); | 80 const std::string kPrefix("blob:uuid/"); |
| 81 if (!base::StartsWithASCII(request->url().spec(), kPrefix, true)) | 81 if (!base::StartsWith(request->url().spec(), kPrefix, |
| 82 base::CompareCase::SENSITIVE)) |
| 82 return NULL; | 83 return NULL; |
| 83 std::string uuid = request->url().spec().substr(kPrefix.length()); | 84 std::string uuid = request->url().spec().substr(kPrefix.length()); |
| 84 scoped_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(uuid); | 85 scoped_ptr<BlobDataHandle> handle = context_->GetBlobDataFromUUID(uuid); |
| 85 scoped_ptr<BlobDataSnapshot> snapshot; | 86 scoped_ptr<BlobDataSnapshot> snapshot; |
| 86 if (handle) { | 87 if (handle) { |
| 87 snapshot = handle->CreateSnapshot().Pass(); | 88 snapshot = handle->CreateSnapshot().Pass(); |
| 88 SetRequestedBlobDataHandle(request, handle.Pass()); | 89 SetRequestedBlobDataHandle(request, handle.Pass()); |
| 89 } | 90 } |
| 90 return snapshot.Pass(); | 91 return snapshot.Pass(); |
| 91 } | 92 } |
| 92 | 93 |
| 93 } // namespace storage | 94 } // namespace storage |
| OLD | NEW |