| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 "net/url_request/view_cache_helper.h" | 5 #include "net/url_request/view_cache_helper.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/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 std::string row = | 66 std::string row = |
| 67 "<tr><td><a href=\"" + url.spec() + "\">" + EscapeForHTML(key) + | 67 "<tr><td><a href=\"" + url.spec() + "\">" + EscapeForHTML(key) + |
| 68 "</a></td></tr>"; | 68 "</a></td></tr>"; |
| 69 return row; | 69 return row; |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace. | 72 } // namespace. |
| 73 | 73 |
| 74 namespace net { | 74 namespace net { |
| 75 | 75 |
| 76 ViewCacheHelper::ViewCacheHelper() |
| 77 : disk_cache_(NULL), |
| 78 entry_(NULL), |
| 79 iter_(NULL), |
| 80 buf_len_(0), |
| 81 index_(0), |
| 82 data_(NULL), |
| 83 callback_(NULL), |
| 84 next_state_(STATE_NONE), |
| 85 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 86 cache_callback_(this, &ViewCacheHelper::OnIOComplete)), |
| 87 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 88 entry_callback_(new CancelableCompletionCallback<ViewCacheHelper>( |
| 89 this, &ViewCacheHelper::OnIOComplete))) { |
| 90 } |
| 91 |
| 76 ViewCacheHelper::~ViewCacheHelper() { | 92 ViewCacheHelper::~ViewCacheHelper() { |
| 77 if (entry_) | 93 if (entry_) |
| 78 entry_->Close(); | 94 entry_->Close(); |
| 79 | 95 |
| 80 // Cancel any pending entry callback. | 96 // Cancel any pending entry callback. |
| 81 entry_callback_->Cancel(); | 97 entry_callback_->Cancel(); |
| 82 } | 98 } |
| 83 | 99 |
| 84 int ViewCacheHelper::GetEntryInfoHTML(const std::string& key, | 100 int ViewCacheHelper::GetEntryInfoHTML(const std::string& key, |
| 85 URLRequestContext* context, | 101 URLRequestContext* context, |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 entry_ = NULL; | 346 entry_ = NULL; |
| 331 } | 347 } |
| 332 return OK; | 348 return OK; |
| 333 } | 349 } |
| 334 | 350 |
| 335 void ViewCacheHelper::OnIOComplete(int result) { | 351 void ViewCacheHelper::OnIOComplete(int result) { |
| 336 DoLoop(result); | 352 DoLoop(result); |
| 337 } | 353 } |
| 338 | 354 |
| 339 } // namespace net. | 355 } // namespace net. |
| OLD | NEW |