| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 11 #include "net/url_request/url_request.h" | 11 #include "net/url_request/url_request.h" |
| 12 #include "net/url_request/url_request_context.h" | 12 #include "net/url_request/url_request_context.h" |
| 13 #include "net/url_request/url_request_simple_job.h" | 13 #include "net/url_request/url_request_simple_job.h" |
| 14 #include "net/url_request/view_cache_helper.h" | 14 #include "net/url_request/view_cache_helper.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // A job subclass that dumps an HTTP cache entry. | 18 // A job subclass that dumps an HTTP cache entry. |
| 19 class ViewHttpCacheJob : public URLRequestJob { | 19 class ViewHttpCacheJob : public net::URLRequestJob { |
| 20 public: | 20 public: |
| 21 explicit ViewHttpCacheJob(URLRequest* request) | 21 explicit ViewHttpCacheJob(URLRequest* request) |
| 22 : URLRequestJob(request), data_offset_(0), cancel_(false), busy_(false), | 22 : URLRequestJob(request), data_offset_(0), cancel_(false), busy_(false), |
| 23 ALLOW_THIS_IN_INITIALIZER_LIST( | 23 ALLOW_THIS_IN_INITIALIZER_LIST( |
| 24 callback_(this, &ViewHttpCacheJob::OnIOComplete)) {} | 24 callback_(this, &ViewHttpCacheJob::OnIOComplete)) {} |
| 25 | 25 |
| 26 virtual void Start(); | 26 virtual void Start(); |
| 27 virtual void Kill(); | 27 virtual void Kill(); |
| 28 virtual bool GetMimeType(std::string* mime_type) const; | 28 virtual bool GetMimeType(std::string* mime_type) const; |
| 29 virtual bool GetCharset(std::string* charset); | 29 virtual bool GetCharset(std::string* charset); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 bool ViewHttpCacheJobFactory::IsSupportedURL(const GURL& url) { | 120 bool ViewHttpCacheJobFactory::IsSupportedURL(const GURL& url) { |
| 121 return StartsWithASCII(url.spec(), chrome::kNetworkViewCacheURL, | 121 return StartsWithASCII(url.spec(), chrome::kNetworkViewCacheURL, |
| 122 true /*case_sensitive*/); | 122 true /*case_sensitive*/); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // Static. | 125 // Static. |
| 126 URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest( | 126 URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest( |
| 127 URLRequest* request) { | 127 URLRequest* request) { |
| 128 return new ViewHttpCacheJob(request); | 128 return new ViewHttpCacheJob(request); |
| 129 } | 129 } |
| OLD | NEW |