Chromium Code Reviews| 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 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(Fetcher); | 115 DISALLOW_COPY_AND_ASSIGN(Fetcher); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 PrecacheFetcher::Fetcher::Fetcher( | 118 PrecacheFetcher::Fetcher::Fetcher( |
| 119 net::URLRequestContextGetter* request_context, const GURL& url, | 119 net::URLRequestContextGetter* request_context, const GURL& url, |
| 120 const base::Callback<void(const URLFetcher&)>& callback) | 120 const base::Callback<void(const URLFetcher&)>& callback) |
| 121 : callback_(callback) { | 121 : callback_(callback) { |
| 122 url_fetcher_.reset(URLFetcher::Create(url, URLFetcher::GET, this)); | 122 url_fetcher_.reset(URLFetcher::Create(url, URLFetcher::GET, this)); |
| 123 url_fetcher_->SetRequestContext(request_context); | 123 url_fetcher_->SetRequestContext(request_context); |
| 124 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_PROMPT_FOR_LOGIN); | |
|
bengr
2014/12/10 23:50:51
mmenke@ suggested that we add this in the first pl
| |
| 125 url_fetcher_->Start(); | 124 url_fetcher_->Start(); |
| 126 } | 125 } |
| 127 | 126 |
| 128 void PrecacheFetcher::Fetcher::OnURLFetchComplete(const URLFetcher* source) { | 127 void PrecacheFetcher::Fetcher::OnURLFetchComplete(const URLFetcher* source) { |
| 129 callback_.Run(*source); | 128 callback_.Run(*source); |
| 130 } | 129 } |
| 131 | 130 |
| 132 PrecacheFetcher::PrecacheFetcher( | 131 PrecacheFetcher::PrecacheFetcher( |
| 133 const std::list<GURL>& starting_urls, | 132 const std::list<GURL>& starting_urls, |
| 134 net::URLRequestContextGetter* request_context, | 133 net::URLRequestContextGetter* request_context, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 246 StartNextFetch(); | 245 StartNextFetch(); |
| 247 } | 246 } |
| 248 | 247 |
| 249 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { | 248 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { |
| 250 // The resource has already been put in the cache during the fetch process, so | 249 // The resource has already been put in the cache during the fetch process, so |
| 251 // nothing more needs to be done for the resource. | 250 // nothing more needs to be done for the resource. |
| 252 StartNextFetch(); | 251 StartNextFetch(); |
| 253 } | 252 } |
| 254 | 253 |
| 255 } // namespace precache | 254 } // namespace precache |
| OLD | NEW |