Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: chrome/browser/net/view_http_cache_job_factory.cc

Issue 7064052: Revert 88142 to fix sync_integration_tests offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/net/view_http_cache_job_factory.h" 5 #include "chrome/browser/net/view_http_cache_job_factory.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 NotifyHeadersComplete(); 120 NotifyHeadersComplete();
121 } 121 }
122 122
123 int ViewHttpCacheJob::Core::Start(const net::URLRequest& request, 123 int ViewHttpCacheJob::Core::Start(const net::URLRequest& request,
124 Callback0::Type* callback) { 124 Callback0::Type* callback) {
125 DCHECK(callback); 125 DCHECK(callback);
126 DCHECK(!user_callback_); 126 DCHECK(!user_callback_);
127 127
128 AddRef(); // Released on OnIOComplete(). 128 AddRef(); // Released on OnIOComplete().
129 std::string cache_key = 129 std::string cache_key =
130 request.url().spec().substr(strlen(chrome::kChromeUINetworkViewCacheURL)); 130 request.url().spec().substr(strlen(chrome::kNetworkViewCacheURL));
131 131
132 int rv; 132 int rv;
133 if (cache_key.empty()) { 133 if (cache_key.empty()) {
134 rv = cache_helper_.GetContentsHTML(request.context(), 134 rv = cache_helper_.GetContentsHTML(request.context(),
135 chrome::kChromeUINetworkViewCacheURL, 135 chrome::kNetworkViewCacheURL, &data_,
136 &data_,
137 &callback_); 136 &callback_);
138 } else { 137 } else {
139 rv = cache_helper_.GetEntryInfoHTML(cache_key, request.context(), 138 rv = cache_helper_.GetEntryInfoHTML(cache_key, request.context(),
140 &data_, &callback_); 139 &data_, &callback_);
141 } 140 }
142 141
143 if (rv == net::ERR_IO_PENDING) 142 if (rv == net::ERR_IO_PENDING)
144 user_callback_ = callback; 143 user_callback_ = callback;
145 144
146 return rv; 145 return rv;
(...skipping 30 matching lines...) Expand all
177 176
178 // We may be holding the last reference to this job. Do not access |this| 177 // We may be holding the last reference to this job. Do not access |this|
179 // after Release(). 178 // after Release().
180 Release(); // Acquired on Start(). 179 Release(); // Acquired on Start().
181 } 180 }
182 181
183 } // namespace. 182 } // namespace.
184 183
185 // Static. 184 // Static.
186 bool ViewHttpCacheJobFactory::IsSupportedURL(const GURL& url) { 185 bool ViewHttpCacheJobFactory::IsSupportedURL(const GURL& url) {
187 return url.SchemeIs(chrome::kChromeUIScheme) && 186 return StartsWithASCII(url.spec(), chrome::kNetworkViewCacheURL,
188 url.host() == chrome::kChromeUINetworkViewCacheHost; 187 true /*case_sensitive*/);
189 } 188 }
190 189
191 // Static. 190 // Static.
192 net::URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest( 191 net::URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest(
193 net::URLRequest* request) { 192 net::URLRequest* request) {
194 return new ViewHttpCacheJob(request); 193 return new ViewHttpCacheJob(request);
195 } 194 }
OLDNEW
« no previous file with comments | « chrome/browser/net/view_blob_internals_job_factory.cc ('k') | chrome/browser/printing/cloud_print/cloud_print_setup_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698