Chromium Code Reviews| Index: webkit/browser/blob/view_blob_internals_job.cc |
| diff --git a/webkit/browser/blob/view_blob_internals_job.cc b/webkit/browser/blob/view_blob_internals_job.cc |
| index 41ef7883de5c2bcb3d8fb0668db5d16ed3b2e274..84c132382b9545cb06145e4808295aae05715b93 100644 |
| --- a/webkit/browser/blob/view_blob_internals_job.cc |
| +++ b/webkit/browser/blob/view_blob_internals_job.cc |
| @@ -17,7 +17,7 @@ |
| #include "net/base/escape.h" |
| #include "net/base/net_errors.h" |
| #include "net/url_request/url_request.h" |
| -#include "webkit/browser/blob/blob_storage_controller.h" |
| +#include "webkit/browser/blob/blob_storage_context.h" |
| #include "webkit/common/blob/blob_data.h" |
| namespace { |
| @@ -79,20 +79,6 @@ void AddHTMLListItem(const std::string& element_title, |
| out->append("</li>"); |
| } |
| -void AddHTMLButton(const std::string& title, |
| - const std::string& command, |
| - std::string* out) { |
| - // No need to escape title since constant string is passed. |
| - std::string escaped_command = net::EscapeForHTML(command.c_str()); |
| - base::StringAppendF(out, |
| - "<form action=\"\" method=\"GET\">\n" |
| - "<input type=\"hidden\" name=\"remove\" value=\"%s\">\n" |
| - "<input type=\"submit\" value=\"%s\">\n" |
| - "</form><br/>\n", |
| - escaped_command.c_str(), |
| - title.c_str()); |
| -} |
| - |
| } // namespace |
| namespace webkit_blob { |
| @@ -100,9 +86,9 @@ namespace webkit_blob { |
| ViewBlobInternalsJob::ViewBlobInternalsJob( |
| net::URLRequest* request, |
| net::NetworkDelegate* network_delegate, |
| - BlobStorageController* blob_storage_controller) |
| + BlobStorageContext* blob_storage_context) |
| : net::URLRequestSimpleJob(request, network_delegate), |
| - blob_storage_controller_(blob_storage_controller), |
| + blob_storage_context_(blob_storage_context), |
| weak_factory_(this) { |
| } |
| @@ -112,7 +98,7 @@ ViewBlobInternalsJob::~ViewBlobInternalsJob() { |
| void ViewBlobInternalsJob::Start() { |
| base::MessageLoop::current()->PostTask( |
| FROM_HERE, |
| - base::Bind(&ViewBlobInternalsJob::DoWorkAsync, |
| + base::Bind(&ViewBlobInternalsJob::StartAsync, |
| weak_factory_.GetWeakPtr())); |
| } |
| @@ -134,18 +120,6 @@ void ViewBlobInternalsJob::Kill() { |
| weak_factory_.InvalidateWeakPtrs(); |
| } |
| -void ViewBlobInternalsJob::DoWorkAsync() { |
| - if (request_->url().has_query() && |
| - StartsWithASCII(request_->url().query(), "remove=", true)) { |
| - std::string blob_url = request_->url().query().substr(strlen("remove=")); |
| - blob_url = net::UnescapeURLComponent(blob_url, |
| - net::UnescapeRule::NORMAL | net::UnescapeRule::URL_SPECIAL_CHARS); |
| - blob_storage_controller_->RemoveBlob(GURL(blob_url)); |
|
ericu
2013/08/21 23:26:09
Can we no longer remove blobs, or what?
michaeln
2013/08/27 23:24:06
It's not really needed afaict and makes checking t
|
| - } |
| - |
| - StartAsync(); |
| -} |
| - |
| int ViewBlobInternalsJob::GetData( |
| std::string* mime_type, |
| std::string* charset, |
| @@ -156,7 +130,7 @@ int ViewBlobInternalsJob::GetData( |
| data->clear(); |
| StartHTML(data); |
| - if (blob_storage_controller_->blob_map_.empty()) |
| + if (blob_storage_context_->blob_map_.empty()) |
| data->append(kEmptyBlobStorageMessage); |
| else |
| GenerateHTML(data); |
| @@ -165,13 +139,12 @@ int ViewBlobInternalsJob::GetData( |
| } |
| void ViewBlobInternalsJob::GenerateHTML(std::string* out) const { |
| - for (BlobStorageController::BlobMap::const_iterator iter = |
| - blob_storage_controller_->blob_map_.begin(); |
| - iter != blob_storage_controller_->blob_map_.end(); |
| + for (BlobStorageContext::BlobMap::const_iterator iter = |
| + blob_storage_context_->blob_map_.begin(); |
| + iter != blob_storage_context_->blob_map_.end(); |
| ++iter) { |
| AddHTMLBoldText(iter->first, out); |
| - AddHTMLButton(kRemove, iter->first, out); |
| - GenerateHTMLForBlobData(*iter->second.get(), out); |
| + GenerateHTMLForBlobData(*(iter->second.data.get()), out); |
| } |
| } |
| @@ -213,12 +186,11 @@ void ViewBlobInternalsJob::GenerateHTMLForBlobData(const BlobData& blob_data, |
| } |
| break; |
| case BlobData::Item::TYPE_BLOB: |
| - AddHTMLListItem(kType, "blob", out); |
| - AddHTMLListItem(kURL, item.url().spec(), out); |
| + NOTREACHED(); // Should be flattened in the storage context. |
| break; |
| case BlobData::Item::TYPE_FILE_FILESYSTEM: |
| AddHTMLListItem(kType, "filesystem", out); |
| - AddHTMLListItem(kURL, item.url().spec(), out); |
| + AddHTMLListItem(kURL, item.filesystem_url().spec(), out); |
| if (!item.expected_modification_time().is_null()) { |
| AddHTMLListItem(kModificationTime, UTF16ToUTF8( |
| TimeFormatFriendlyDateAndTime(item.expected_modification_time())), |
| @@ -246,3 +218,4 @@ void ViewBlobInternalsJob::GenerateHTMLForBlobData(const BlobData& blob_data, |
| } |
| } // namespace webkit_blob |
| + |
|
ericu
2013/08/21 23:26:09
Nit: extra whitespace?
michaeln
2013/08/27 23:24:06
Done.
|