OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/appcache/view_appcache_internals_job.h" | 5 #include "webkit/browser/appcache/view_appcache_internals_job.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 out->append("\n<br/>\n"); | 121 out->append("\n<br/>\n"); |
122 EmitCommandAnchor(kRemoveCacheLabel, base_url, | 122 EmitCommandAnchor(kRemoveCacheLabel, base_url, |
123 kRemoveCacheCommand, manifest_url_base64.c_str(), out); | 123 kRemoveCacheCommand, manifest_url_base64.c_str(), out); |
124 out->append(" "); | 124 out->append(" "); |
125 EmitCommandAnchor(kViewCacheLabel, base_url, | 125 EmitCommandAnchor(kViewCacheLabel, base_url, |
126 kViewCacheCommand, manifest_url_base64.c_str(), out); | 126 kViewCacheCommand, manifest_url_base64.c_str(), out); |
127 out->append("\n<br/>\n"); | 127 out->append("\n<br/>\n"); |
128 out->append("<ul>"); | 128 out->append("<ul>"); |
129 EmitListItem( | 129 EmitListItem( |
130 kSize, | 130 kSize, |
131 UTF16ToUTF8(FormatBytesUnlocalized(info->size)), | 131 base::UTF16ToUTF8(FormatBytesUnlocalized(info->size)), |
132 out); | 132 out); |
133 EmitListItem( | 133 EmitListItem( |
134 kCreationTime, | 134 kCreationTime, |
135 UTF16ToUTF8(TimeFormatFriendlyDateAndTime(info->creation_time)), | 135 base::UTF16ToUTF8(TimeFormatFriendlyDateAndTime(info->creation_time)), |
136 out); | 136 out); |
137 EmitListItem( | 137 EmitListItem( |
138 kLastUpdateTime, | 138 kLastUpdateTime, |
139 UTF16ToUTF8(TimeFormatFriendlyDateAndTime(info->last_update_time)), | 139 base::UTF16ToUTF8(TimeFormatFriendlyDateAndTime(info->last_update_time)), |
140 out); | 140 out); |
141 EmitListItem( | 141 EmitListItem( |
142 kLastAccessTime, | 142 kLastAccessTime, |
143 UTF16ToUTF8(TimeFormatFriendlyDateAndTime(info->last_access_time)), | 143 base::UTF16ToUTF8(TimeFormatFriendlyDateAndTime(info->last_access_time)), |
144 out); | 144 out); |
145 out->append("</ul></p></br>\n"); | 145 out->append("</ul></p></br>\n"); |
146 } | 146 } |
147 | 147 |
148 void EmitAppCacheInfoVector( | 148 void EmitAppCacheInfoVector( |
149 const GURL& base_url, | 149 const GURL& base_url, |
150 AppCacheService* service, | 150 AppCacheService* service, |
151 const AppCacheInfoVector& appcaches, | 151 const AppCacheInfoVector& appcaches, |
152 std::string* out) { | 152 std::string* out) { |
153 for (std::vector<AppCacheInfo>::const_iterator info = | 153 for (std::vector<AppCacheInfo>::const_iterator info = |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 out->append("</tr>\n"); | 235 out->append("</tr>\n"); |
236 for (AppCacheResourceInfoVector::const_iterator | 236 for (AppCacheResourceInfoVector::const_iterator |
237 iter = resource_infos.begin(); | 237 iter = resource_infos.begin(); |
238 iter != resource_infos.end(); ++iter) { | 238 iter != resource_infos.end(); ++iter) { |
239 out->append("<tr>"); | 239 out->append("<tr>"); |
240 EmitTableData(FormFlagsString(*iter), false, false, out); | 240 EmitTableData(FormFlagsString(*iter), false, false, out); |
241 EmitTableData(FormViewEntryAnchor(base_url, manifest_url, | 241 EmitTableData(FormViewEntryAnchor(base_url, manifest_url, |
242 iter->url, iter->response_id, | 242 iter->url, iter->response_id, |
243 group_id), | 243 group_id), |
244 false, false, out); | 244 false, false, out); |
245 EmitTableData(UTF16ToUTF8(FormatBytesUnlocalized(iter->size)), | 245 EmitTableData(base::UTF16ToUTF8(FormatBytesUnlocalized(iter->size)), |
246 true, false, out); | 246 true, false, out); |
247 out->append("</tr>\n"); | 247 out->append("</tr>\n"); |
248 } | 248 } |
249 out->append("</table>\n"); | 249 out->append("</table>\n"); |
250 } | 250 } |
251 | 251 |
252 void EmitResponseHeaders(net::HttpResponseHeaders* headers, std::string* out) { | 252 void EmitResponseHeaders(net::HttpResponseHeaders* headers, std::string* out) { |
253 out->append("<hr><pre>"); | 253 out->append("<hr><pre>"); |
254 out->append(net::EscapeForHTML(headers->GetStatusLine())); | 254 out->append(net::EscapeForHTML(headers->GetStatusLine())); |
255 out->push_back('\n'); | 255 out->push_back('\n'); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 return new ViewEntryJob(request, network_delegate, service, | 661 return new ViewEntryJob(request, network_delegate, service, |
662 DecodeBase64URL(tokens[0]), // manifest url | 662 DecodeBase64URL(tokens[0]), // manifest url |
663 DecodeBase64URL(tokens[1]), // entry url | 663 DecodeBase64URL(tokens[1]), // entry url |
664 response_id, group_id); | 664 response_id, group_id); |
665 } | 665 } |
666 | 666 |
667 return new RedirectToMainPageJob(request, network_delegate, service); | 667 return new RedirectToMainPageJob(request, network_delegate, service); |
668 } | 668 } |
669 | 669 |
670 } // namespace appcache | 670 } // namespace appcache |
OLD | NEW |