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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 int ReadRawData(net::IOBuffer* buf, int buf_size) override { | 51 int ReadRawData(net::IOBuffer* buf, int buf_size) override { |
52 return core_->ReadRawData(buf, buf_size); | 52 return core_->ReadRawData(buf, buf_size); |
53 } | 53 } |
54 | 54 |
55 private: | 55 private: |
56 class Core : public base::RefCounted<Core> { | 56 class Core : public base::RefCounted<Core> { |
57 public: | 57 public: |
58 Core() | 58 Core() |
59 : data_offset_(0), | 59 : data_offset_(0), |
60 callback_(base::Bind(&Core::OnIOComplete, this)) { | 60 callback_(base::Bind(&Core::OnIOComplete, base::Unretained(this))) {} |
61 } | |
62 | 61 |
63 int Start(const net::URLRequest& request, const base::Closure& callback); | 62 int Start(const net::URLRequest& request, const base::Closure& callback); |
64 | 63 |
65 // Prevents it from invoking its callback. It will self-delete. | 64 // Prevents it from invoking its callback. It will self-delete. |
66 void Orphan() { | 65 void Orphan() { |
67 user_callback_.Reset(); | 66 user_callback_.Reset(); |
68 } | 67 } |
69 | 68 |
70 bool GetMimeType(std::string* mime_type) const; | 69 bool GetMimeType(std::string* mime_type) const; |
71 bool GetCharset(std::string* charset); | 70 bool GetCharset(std::string* charset); |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 url.host_piece() == kChromeUINetworkViewCacheHost; | 196 url.host_piece() == kChromeUINetworkViewCacheHost; |
198 } | 197 } |
199 | 198 |
200 // Static. | 199 // Static. |
201 net::URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest( | 200 net::URLRequestJob* ViewHttpCacheJobFactory::CreateJobForRequest( |
202 net::URLRequest* request, net::NetworkDelegate* network_delegate) { | 201 net::URLRequest* request, net::NetworkDelegate* network_delegate) { |
203 return new ViewHttpCacheJob(request, network_delegate); | 202 return new ViewHttpCacheJob(request, network_delegate); |
204 } | 203 } |
205 | 204 |
206 } // namespace content | 205 } // namespace content |
OLD | NEW |