OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/blob/view_blob_internals_job.h" | 5 #include "webkit/blob/view_blob_internals_job.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 title.c_str(), | 95 title.c_str(), |
96 command.c_str()); | 96 command.c_str()); |
97 } | 97 } |
98 | 98 |
99 } // namespace | 99 } // namespace |
100 | 100 |
101 namespace webkit_blob { | 101 namespace webkit_blob { |
102 | 102 |
103 ViewBlobInternalsJob::ViewBlobInternalsJob( | 103 ViewBlobInternalsJob::ViewBlobInternalsJob( |
104 net::URLRequest* request, BlobStorageController* blob_storage_controller) | 104 net::URLRequest* request, BlobStorageController* blob_storage_controller) |
105 : URLRequestSimpleJob(request), | 105 : net::URLRequestSimpleJob(request), |
106 blob_storage_controller_(blob_storage_controller), | 106 blob_storage_controller_(blob_storage_controller), |
107 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { | 107 ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) { |
108 } | 108 } |
109 | 109 |
110 ViewBlobInternalsJob::~ViewBlobInternalsJob() { | 110 ViewBlobInternalsJob::~ViewBlobInternalsJob() { |
111 } | 111 } |
112 | 112 |
113 void ViewBlobInternalsJob::Start() { | 113 void ViewBlobInternalsJob::Start() { |
114 MessageLoop::current()->PostTask( | 114 MessageLoop::current()->PostTask( |
115 FROM_HERE, | 115 FROM_HERE, |
116 method_factory_.NewRunnableMethod(&ViewBlobInternalsJob::DoWorkAsync)); | 116 method_factory_.NewRunnableMethod(&ViewBlobInternalsJob::DoWorkAsync)); |
117 } | 117 } |
118 | 118 |
119 bool ViewBlobInternalsJob::IsRedirectResponse(GURL* location, | 119 bool ViewBlobInternalsJob::IsRedirectResponse(GURL* location, |
120 int* http_status_code) { | 120 int* http_status_code) { |
121 if (request_->url().has_query()) { | 121 if (request_->url().has_query()) { |
122 // Strip the query parameters. | 122 // Strip the query parameters. |
123 GURL::Replacements replacements; | 123 GURL::Replacements replacements; |
124 replacements.ClearQuery(); | 124 replacements.ClearQuery(); |
125 *location = request_->url().ReplaceComponents(replacements); | 125 *location = request_->url().ReplaceComponents(replacements); |
126 *http_status_code = 307; | 126 *http_status_code = 307; |
127 return true; | 127 return true; |
128 } | 128 } |
129 return false; | 129 return false; |
130 } | 130 } |
131 | 131 |
132 void ViewBlobInternalsJob::Kill() { | 132 void ViewBlobInternalsJob::Kill() { |
133 URLRequestSimpleJob::Kill(); | 133 net::URLRequestSimpleJob::Kill(); |
134 method_factory_.RevokeAll(); | 134 method_factory_.RevokeAll(); |
135 } | 135 } |
136 | 136 |
137 void ViewBlobInternalsJob::DoWorkAsync() { | 137 void ViewBlobInternalsJob::DoWorkAsync() { |
138 if (request_->url().has_query() && | 138 if (request_->url().has_query() && |
139 StartsWithASCII(request_->url().query(), "remove=", true)) { | 139 StartsWithASCII(request_->url().query(), "remove=", true)) { |
140 std::string blob_url = request_->url().query().substr(strlen("remove=")); | 140 std::string blob_url = request_->url().query().substr(strlen("remove=")); |
141 blob_url = UnescapeURLComponent(blob_url, | 141 blob_url = UnescapeURLComponent(blob_url, |
142 UnescapeRule::NORMAL | UnescapeRule::URL_SPECIAL_CHARS); | 142 UnescapeRule::NORMAL | UnescapeRule::URL_SPECIAL_CHARS); |
143 blob_storage_controller_->UnregisterBlobUrl(GURL(blob_url)); | 143 blob_storage_controller_->UnregisterBlobUrl(GURL(blob_url)); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 | 231 |
232 if (has_multi_items) | 232 if (has_multi_items) |
233 EndHTMLList(out); | 233 EndHTMLList(out); |
234 } | 234 } |
235 | 235 |
236 EndHTMLList(out); | 236 EndHTMLList(out); |
237 } | 237 } |
238 | 238 |
239 } // namespace webkit_blob | 239 } // namespace webkit_blob |
OLD | NEW |