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

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

Issue 2761303002: Move common ImageFetcher component files to core/ (Closed)
Patch Set: Rebased. Created 3 years, 9 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/core/image_data_fetcher.h"
6 6
7 #include "net/base/load_flags.h" 7 #include "net/base/load_flags.h"
8 #include "net/http/http_response_headers.h" 8 #include "net/http/http_response_headers.h"
9 #include "net/http/http_status_code.h" 9 #include "net/http/http_status_code.h"
10 #include "net/url_request/url_fetcher.h" 10 #include "net/url_request/url_fetcher.h"
11 #include "net/url_request/url_request_context_getter.h" 11 #include "net/url_request/url_request_context_getter.h"
12 #include "net/url_request/url_request_status.h" 12 #include "net/url_request/url_request_status.h"
13 #include "url/gurl.h" 13 #include "url/gurl.h"
14 14
15 using data_use_measurement::DataUseUserData; 15 using data_use_measurement::DataUseUserData;
16 16
17 namespace image_fetcher { 17 namespace image_fetcher {
18 18
19 // An active image URL fetcher request. The struct contains the related requests 19 // An active image URL fetcher request. The struct contains the related requests
20 // state. 20 // state.
21 struct ImageDataFetcher::ImageDataFetcherRequest { 21 struct ImageDataFetcher::ImageDataFetcherRequest {
22 ImageDataFetcherRequest(const ImageDataFetcherCallback& callback, 22 ImageDataFetcherRequest(const ImageDataFetcherCallback& callback,
23 std::unique_ptr<net::URLFetcher> url_fetcher) 23 std::unique_ptr<net::URLFetcher> url_fetcher)
24 : callback(callback), 24 : callback(callback), url_fetcher(std::move(url_fetcher)) {}
25 url_fetcher(std::move(url_fetcher)) {}
26 25
27 ~ImageDataFetcherRequest() {} 26 ~ImageDataFetcherRequest() {}
28 27
29 // The callback to run after the image data was fetched. The callback will 28 // The callback to run after the image data was fetched. The callback will
30 // be run even if the image data could not be fetched successfully. 29 // be run even if the image data could not be fetched successfully.
31 ImageDataFetcherCallback callback; 30 ImageDataFetcherCallback callback;
32 31
33 std::unique_ptr<net::URLFetcher> url_fetcher; 32 std::unique_ptr<net::URLFetcher> url_fetcher;
34 }; 33 };
35 34
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (success) { 94 if (success) {
96 source->GetResponseAsString(&image_data); 95 source->GetResponseAsString(&image_data);
97 } 96 }
98 request_iter->second->callback.Run(image_data, metadata); 97 request_iter->second->callback.Run(image_data, metadata);
99 98
100 // Remove the finished request. 99 // Remove the finished request.
101 pending_requests_.erase(request_iter); 100 pending_requests_.erase(request_iter);
102 } 101 }
103 102
104 } // namespace image_fetcher 103 } // namespace image_fetcher
OLDNEW
« no previous file with comments | « components/image_fetcher/core/image_data_fetcher.h ('k') | components/image_fetcher/core/image_data_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698