OLD | NEW |
---|---|
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 #ifndef COMPONENTS_IMAGE_FETCHER_IMAGE_DATA_FETCHER_H_ | 5 #ifndef COMPONENTS_IMAGE_FETCHER_IMAGE_DATA_FETCHER_H_ |
6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_DATA_FETCHER_H_ | 6 #define COMPONENTS_IMAGE_FETCHER_IMAGE_DATA_FETCHER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 | 42 |
43 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName; | 43 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName; |
44 | 44 |
45 explicit ImageDataFetcher( | 45 explicit ImageDataFetcher( |
46 net::URLRequestContextGetter* url_request_context_getter); | 46 net::URLRequestContextGetter* url_request_context_getter); |
47 ~ImageDataFetcher() override; | 47 ~ImageDataFetcher() override; |
48 | 48 |
49 // Sets a service name against which to track data usage. | 49 // Sets a service name against which to track data usage. |
50 void SetDataUseServiceName(DataUseServiceName data_use_service_name); | 50 void SetDataUseServiceName(DataUseServiceName data_use_service_name); |
51 | 51 |
52 // Disables sending cookies together with the HTTP request. | |
53 void DisableCookies(); | |
Marc Treib
2017/03/16 10:04:56
I prefer formulating things positively: EnableCook
| |
54 | |
52 // Fetches the raw image bytes from the given |image_url| and calls the given | 55 // Fetches the raw image bytes from the given |image_url| and calls the given |
53 // |callback|. The callback is run even if fetching the URL fails. In case | 56 // |callback|. The callback is run even if fetching the URL fails. In case |
54 // of an error an empty string is passed to the callback. | 57 // of an error an empty string is passed to the callback. |
55 void FetchImageData(const GURL& image_url, | 58 void FetchImageData(const GURL& image_url, |
56 const ImageDataFetcherCallback& callback); | 59 const ImageDataFetcherCallback& callback); |
57 | 60 |
58 // Like above, but lets the caller set a referrer. | 61 // Like above, but lets the caller set a referrer. |
59 void FetchImageData(const GURL& image_url, | 62 void FetchImageData(const GURL& image_url, |
60 const ImageDataFetcherCallback& callback, | 63 const ImageDataFetcherCallback& callback, |
61 const std::string& referrer, | 64 const std::string& referrer, |
(...skipping 13 matching lines...) Expand all Loading... | |
75 | 78 |
76 DataUseServiceName data_use_service_name_; | 79 DataUseServiceName data_use_service_name_; |
77 | 80 |
78 // The next ID to use for a newly created URLFetcher. Each URLFetcher gets an | 81 // The next ID to use for a newly created URLFetcher. Each URLFetcher gets an |
79 // id when it is created. The |url_fetcher_id_| is incremented by one for each | 82 // id when it is created. The |url_fetcher_id_| is incremented by one for each |
80 // newly created URLFetcher. The URLFetcher ID can be used during testing to | 83 // newly created URLFetcher. The URLFetcher ID can be used during testing to |
81 // get individual URLFetchers and modify their state. Outside of tests this ID | 84 // get individual URLFetchers and modify their state. Outside of tests this ID |
82 // is not used. | 85 // is not used. |
83 int next_url_fetcher_id_; | 86 int next_url_fetcher_id_; |
84 | 87 |
88 bool disable_cookies_; | |
89 | |
85 DISALLOW_COPY_AND_ASSIGN(ImageDataFetcher); | 90 DISALLOW_COPY_AND_ASSIGN(ImageDataFetcher); |
86 }; | 91 }; |
87 | 92 |
88 } // namespace image_fetcher | 93 } // namespace image_fetcher |
89 | 94 |
90 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_DATA_FETCHER_H_ | 95 #endif // COMPONENTS_IMAGE_FETCHER_IMAGE_DATA_FETCHER_H_ |
OLD | NEW |