| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/url_request/url_request_view_cache_job.h" | 5 #include "net/url_request/url_request_view_cache_job.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "net/base/escape.h" | 8 #include "net/base/escape.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/disk_cache/disk_cache.h" | 10 #include "net/disk_cache/disk_cache.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 std::string key = EscapeForHTML(entry->GetKey()); | 59 std::string key = EscapeForHTML(entry->GetKey()); |
| 60 std::string row = | 60 std::string row = |
| 61 "<tr><td><a href=\"view-cache:" + key + "\">" + key + "</a></td></tr>"; | 61 "<tr><td><a href=\"view-cache:" + key + "\">" + key + "</a></td></tr>"; |
| 62 return row; | 62 return row; |
| 63 } | 63 } |
| 64 | 64 |
| 65 static std::string FormatEntryDetails(disk_cache::Entry* entry) { | 65 static std::string FormatEntryDetails(disk_cache::Entry* entry) { |
| 66 std::string result = EscapeForHTML(entry->GetKey()); | 66 std::string result = EscapeForHTML(entry->GetKey()); |
| 67 | 67 |
| 68 net::HttpResponseInfo response; | 68 net::HttpResponseInfo response; |
| 69 if (net::HttpCache::ReadResponseInfo(entry, &response) && response.headers) { | 69 bool truncated; |
| 70 if (net::HttpCache::ReadResponseInfo(entry, &response, &truncated) && |
| 71 response.headers) { |
| 70 result.append("<hr><pre>"); | 72 result.append("<hr><pre>"); |
| 71 result.append(EscapeForHTML(response.headers->GetStatusLine())); | 73 result.append(EscapeForHTML(response.headers->GetStatusLine())); |
| 72 result.push_back('\n'); | 74 result.push_back('\n'); |
| 73 | 75 |
| 74 void* iter = NULL; | 76 void* iter = NULL; |
| 75 std::string name, value; | 77 std::string name, value; |
| 76 while (response.headers->EnumerateHeaderLines(&iter, &name, &value)) { | 78 while (response.headers->EnumerateHeaderLines(&iter, &name, &value)) { |
| 77 result.append(EscapeForHTML(name)); | 79 result.append(EscapeForHTML(name)); |
| 78 result.append(": "); | 80 result.append(": "); |
| 79 result.append(EscapeForHTML(value)); | 81 result.append(EscapeForHTML(value)); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 if (!request_->context()->http_transaction_factory()) | 164 if (!request_->context()->http_transaction_factory()) |
| 163 return NULL; | 165 return NULL; |
| 164 | 166 |
| 165 net::HttpCache* http_cache = | 167 net::HttpCache* http_cache = |
| 166 request_->context()->http_transaction_factory()->GetCache(); | 168 request_->context()->http_transaction_factory()->GetCache(); |
| 167 if (!http_cache) | 169 if (!http_cache) |
| 168 return NULL; | 170 return NULL; |
| 169 | 171 |
| 170 return http_cache->disk_cache(); | 172 return http_cache->disk_cache(); |
| 171 } | 173 } |
| OLD | NEW |