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

Side by Side Diff: components/image_fetcher/core/image_fetcher_impl.cc

Issue 2886443002: [Doodle] Move image fetching from LogoBridge to DoodleService (Closed)
Patch Set: comment Created 3 years, 7 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
« no previous file with comments | « components/image_fetcher/core/image_fetcher_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/core/image_fetcher_impl.h" 5 #include "components/image_fetcher/core/image_fetcher_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "net/base/load_flags.h" 10 #include "net/base/load_flags.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 ImageRequest request; 59 ImageRequest request;
60 request.id = id; 60 request.id = id;
61 request.callbacks.push_back(callback); 61 request.callbacks.push_back(callback);
62 pending_net_requests_[image_url].swap(&request); 62 pending_net_requests_[image_url].swap(&request);
63 63
64 image_data_fetcher_->FetchImageData( 64 image_data_fetcher_->FetchImageData(
65 image_url, base::Bind(&ImageFetcherImpl::OnImageURLFetched, 65 image_url, base::Bind(&ImageFetcherImpl::OnImageURLFetched,
66 base::Unretained(this), image_url)); 66 base::Unretained(this), image_url));
67 } else { 67 } else {
68 // Request in progress. Register as an interested callback. 68 // Request in progress. Register as an interested callback.
69 // TODO(treib,markusheintz): We're not guaranteed that the ID also matches.
70 // We probably have to store them all.
69 it->second.callbacks.push_back(callback); 71 it->second.callbacks.push_back(callback);
70 } 72 }
71 } 73 }
72 74
73 void ImageFetcherImpl::OnImageURLFetched(const GURL& image_url, 75 void ImageFetcherImpl::OnImageURLFetched(const GURL& image_url,
74 const std::string& image_data, 76 const std::string& image_data,
75 const RequestMetadata& metadata) { 77 const RequestMetadata& metadata) {
76 // Inform the ImageFetcherDelegate. 78 // Inform the ImageFetcherDelegate.
77 if (delegate_) { 79 if (delegate_) {
78 auto it = pending_net_requests_.find(image_url); 80 auto it = pending_net_requests_.find(image_url);
(...skipping 27 matching lines...) Expand all
106 108
107 // Erase the completed ImageRequest. 109 // Erase the completed ImageRequest.
108 pending_net_requests_.erase(image_iter); 110 pending_net_requests_.erase(image_iter);
109 } 111 }
110 112
111 ImageDecoder* ImageFetcherImpl::GetImageDecoder() { 113 ImageDecoder* ImageFetcherImpl::GetImageDecoder() {
112 return image_decoder_.get(); 114 return image_decoder_.get();
113 } 115 }
114 116
115 } // namespace image_fetcher 117 } // namespace image_fetcher
OLDNEW
« no previous file with comments | « components/image_fetcher/core/image_fetcher_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698