| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "ios/chrome/browser/net/image_fetcher.h" | 5 #import "ios/chrome/browser/net/image_fetcher.h" |
| 6 | 6 |
| 7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 delete pair.first; | 76 delete pair.first; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 void ImageFetcher::StartDownload( | 80 void ImageFetcher::StartDownload( |
| 81 const GURL& url, | 81 const GURL& url, |
| 82 ImageFetchedCallback callback, | 82 ImageFetchedCallback callback, |
| 83 const std::string& referrer, | 83 const std::string& referrer, |
| 84 net::URLRequest::ReferrerPolicy referrer_policy) { | 84 net::URLRequest::ReferrerPolicy referrer_policy) { |
| 85 DCHECK(request_context_getter_.get()); | 85 DCHECK(request_context_getter_.get()); |
| 86 net::URLFetcher* fetcher = net::URLFetcher::Create(url, | 86 net::URLFetcher* fetcher = |
| 87 net::URLFetcher::GET, | 87 net::URLFetcher::Create(url, net::URLFetcher::GET, this).release(); |
| 88 this); | |
| 89 downloads_in_progress_[fetcher] = [callback copy]; | 88 downloads_in_progress_[fetcher] = [callback copy]; |
| 90 fetcher->SetLoadFlags( | 89 fetcher->SetLoadFlags( |
| 91 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | | 90 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | |
| 92 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 91 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
| 93 fetcher->SetRequestContext(request_context_getter_.get()); | 92 fetcher->SetRequestContext(request_context_getter_.get()); |
| 94 fetcher->SetReferrer(referrer); | 93 fetcher->SetReferrer(referrer); |
| 95 fetcher->SetReferrerPolicy(referrer_policy); | 94 fetcher->SetReferrerPolicy(referrer_policy); |
| 96 fetcher->Start(); | 95 fetcher->Start(); |
| 97 } | 96 } |
| 98 | 97 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 NSData* data) { | 168 NSData* data) { |
| 170 (callback.get())(url, http_response_code, data); | 169 (callback.get())(url, http_response_code, data); |
| 171 } | 170 } |
| 172 | 171 |
| 173 void ImageFetcher::SetRequestContextGetter( | 172 void ImageFetcher::SetRequestContextGetter( |
| 174 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { | 173 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { |
| 175 request_context_getter_ = request_context_getter; | 174 request_context_getter_ = request_context_getter; |
| 176 } | 175 } |
| 177 | 176 |
| 178 } // namespace image_fetcher | 177 } // namespace image_fetcher |
| OLD | NEW |