OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/precache/core/precache_fetcher.h" | 5 #include "components/precache/core/precache_fetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 const base::Callback<void(const URLFetcher&)> callback_; | 114 const base::Callback<void(const URLFetcher&)> callback_; |
115 scoped_ptr<URLFetcher> url_fetcher_; | 115 scoped_ptr<URLFetcher> url_fetcher_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(Fetcher); | 117 DISALLOW_COPY_AND_ASSIGN(Fetcher); |
118 }; | 118 }; |
119 | 119 |
120 PrecacheFetcher::Fetcher::Fetcher( | 120 PrecacheFetcher::Fetcher::Fetcher( |
121 net::URLRequestContextGetter* request_context, const GURL& url, | 121 net::URLRequestContextGetter* request_context, const GURL& url, |
122 const base::Callback<void(const URLFetcher&)>& callback) | 122 const base::Callback<void(const URLFetcher&)>& callback) |
123 : callback_(callback) { | 123 : callback_(callback) { |
124 url_fetcher_.reset(URLFetcher::Create(url, URLFetcher::GET, this)); | 124 url_fetcher_ = URLFetcher::Create(url, URLFetcher::GET, this); |
125 url_fetcher_->SetRequestContext(request_context); | 125 url_fetcher_->SetRequestContext(request_context); |
126 url_fetcher_->Start(); | 126 url_fetcher_->Start(); |
127 } | 127 } |
128 | 128 |
129 void PrecacheFetcher::Fetcher::OnURLFetchComplete(const URLFetcher* source) { | 129 void PrecacheFetcher::Fetcher::OnURLFetchComplete(const URLFetcher* source) { |
130 callback_.Run(*source); | 130 callback_.Run(*source); |
131 } | 131 } |
132 | 132 |
133 PrecacheFetcher::PrecacheFetcher( | 133 PrecacheFetcher::PrecacheFetcher( |
134 const std::list<GURL>& starting_urls, | 134 const std::list<GURL>& starting_urls, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 StartNextFetch(); | 247 StartNextFetch(); |
248 } | 248 } |
249 | 249 |
250 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { | 250 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { |
251 // The resource has already been put in the cache during the fetch process, so | 251 // The resource has already been put in the cache during the fetch process, so |
252 // nothing more needs to be done for the resource. | 252 // nothing more needs to be done for the resource. |
253 StartNextFetch(); | 253 StartNextFetch(); |
254 } | 254 } |
255 | 255 |
256 } // namespace precache | 256 } // namespace precache |
OLD | NEW |