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 "content/browser/net/view_http_cache_job_factory.h" | 5 #include "content/browser/net/view_http_cache_job_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 NotifyHeadersComplete(); | 129 NotifyHeadersComplete(); |
130 } | 130 } |
131 | 131 |
132 int ViewHttpCacheJob::Core::Start(const net::URLRequest& request, | 132 int ViewHttpCacheJob::Core::Start(const net::URLRequest& request, |
133 const base::Closure& callback) { | 133 const base::Closure& callback) { |
134 DCHECK(!callback.is_null()); | 134 DCHECK(!callback.is_null()); |
135 DCHECK(user_callback_.is_null()); | 135 DCHECK(user_callback_.is_null()); |
136 | 136 |
137 AddRef(); // Released on OnIOComplete(). | 137 AddRef(); // Released on OnIOComplete(). |
138 std::string cache_key = | 138 std::string cache_key = |
139 request.url().spec().substr(strlen(chrome::kChromeUINetworkViewCacheURL)); | 139 request.url().spec().substr(strlen(kChromeUINetworkViewCacheURL)); |
140 | 140 |
141 int rv; | 141 int rv; |
142 if (cache_key.empty()) { | 142 if (cache_key.empty()) { |
143 rv = cache_helper_.GetContentsHTML(request.context(), | 143 rv = cache_helper_.GetContentsHTML(request.context(), |
144 chrome::kChromeUINetworkViewCacheURL, | 144 kChromeUINetworkViewCacheURL, |
145 &data_, callback_); | 145 &data_, callback_); |
146 } else { | 146 } else { |
147 rv = cache_helper_.GetEntryInfoHTML(cache_key, request.context(), | 147 rv = cache_helper_.GetEntryInfoHTML(cache_key, request.context(), |
148 &data_, callback_); | 148 &data_, callback_); |
149 } | 149 } |
150 | 150 |
151 if (rv == net::ERR_IO_PENDING) | 151 if (rv == net::ERR_IO_PENDING) |
152 user_callback_ = callback; | 152 user_callback_ = callback; |
153 | 153 |
154 return rv; | 154 return rv; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 url.host() == chrome::kChromeUINetworkViewCacheHost; | 196 url.host() == chrome::kChromeUINetworkViewCacheHost; |
197 } | 197 } |
198 | 198 |
199 // Static. | 199 // Static. |
200 net::URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest( | 200 net::URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest( |
201 net::URLRequest* request, net::NetworkDelegate* network_delegate) { | 201 net::URLRequest* request, net::NetworkDelegate* network_delegate) { |
202 return new ViewHttpCacheJob(request, network_delegate); | 202 return new ViewHttpCacheJob(request, network_delegate); |
203 } | 203 } |
204 | 204 |
205 } // namespace content | 205 } // namespace content |
OLD | NEW |