| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_.reset(URLFetcher::Create(url, URLFetcher::GET, this)); |
| 125 url_fetcher_->SetRequestContext(request_context); | 125 url_fetcher_->SetRequestContext(request_context); |
| 126 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_PROMPT_FOR_LOGIN); | |
| 127 url_fetcher_->Start(); | 126 url_fetcher_->Start(); |
| 128 } | 127 } |
| 129 | 128 |
| 130 void PrecacheFetcher::Fetcher::OnURLFetchComplete(const URLFetcher* source) { | 129 void PrecacheFetcher::Fetcher::OnURLFetchComplete(const URLFetcher* source) { |
| 131 callback_.Run(*source); | 130 callback_.Run(*source); |
| 132 } | 131 } |
| 133 | 132 |
| 134 PrecacheFetcher::PrecacheFetcher( | 133 PrecacheFetcher::PrecacheFetcher( |
| 135 const std::list<GURL>& starting_urls, | 134 const std::list<GURL>& starting_urls, |
| 136 net::URLRequestContextGetter* request_context, | 135 net::URLRequestContextGetter* request_context, |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 StartNextFetch(); | 247 StartNextFetch(); |
| 249 } | 248 } |
| 250 | 249 |
| 251 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { | 250 void PrecacheFetcher::OnResourceFetchComplete(const URLFetcher& source) { |
| 252 // 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 |
| 253 // nothing more needs to be done for the resource. | 252 // nothing more needs to be done for the resource. |
| 254 StartNextFetch(); | 253 StartNextFetch(); |
| 255 } | 254 } |
| 256 | 255 |
| 257 } // namespace precache | 256 } // namespace precache |
| OLD | NEW |