Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Side by Side Diff: components/image_fetcher/image_data_fetcher.cc

Issue 2652893005: Create the IOSImageDataFetcher (Closed)
Patch Set: Address comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/image_fetcher/image_data_fetcher.h" 5 #include "components/image_fetcher/image_data_fetcher.h"
6 6
7 #include "net/base/load_flags.h" 7 #include "net/base/load_flags.h"
8 #include "net/url_request/url_fetcher.h" 8 #include "net/url_request/url_fetcher.h"
9 #include "net/url_request/url_request.h" 9 #include "net/url_request/url_request.h"
10 #include "net/url_request/url_request_context_getter.h" 10 #include "net/url_request/url_request_context_getter.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 63
64 void ImageDataFetcher::OnURLFetchComplete(const net::URLFetcher* source) { 64 void ImageDataFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
65 auto request_iter = pending_requests_.find(source); 65 auto request_iter = pending_requests_.find(source);
66 DCHECK(request_iter != pending_requests_.end()); 66 DCHECK(request_iter != pending_requests_.end());
67 67
68 std::string image_data; 68 std::string image_data;
69 if (source->GetStatus().status() == net::URLRequestStatus::SUCCESS) { 69 if (source->GetStatus().status() == net::URLRequestStatus::SUCCESS) {
70 source->GetResponseAsString(&image_data); 70 source->GetResponseAsString(&image_data);
71 } 71 }
72 request_iter->second->callback.Run(image_data); 72 request_iter->second->callback.Run(image_data, source);
73 73
74 // Remove the finished request. 74 // Remove the finished request.
75 pending_requests_.erase(request_iter); 75 pending_requests_.erase(request_iter);
76 } 76 }
77 77
78 } // namespace image_fetcher 78 } // namespace image_fetcher
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698