| OLD | NEW |
| 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 #ifndef COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_H_ | 5 #ifndef COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_H_ |
| 6 #define COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_H_ | 6 #define COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 const RequestMetadata& metadata)>; | 37 const RequestMetadata& metadata)>; |
| 38 | 38 |
| 39 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName; | 39 using DataUseServiceName = data_use_measurement::DataUseUserData::ServiceName; |
| 40 | 40 |
| 41 virtual void SetImageFetcherDelegate(ImageFetcherDelegate* delegate) = 0; | 41 virtual void SetImageFetcherDelegate(ImageFetcherDelegate* delegate) = 0; |
| 42 | 42 |
| 43 // Sets a service name against which to track data usage. | 43 // Sets a service name against which to track data usage. |
| 44 virtual void SetDataUseServiceName( | 44 virtual void SetDataUseServiceName( |
| 45 DataUseServiceName data_use_service_name) = 0; | 45 DataUseServiceName data_use_service_name) = 0; |
| 46 | 46 |
| 47 // Sets an upper limit for image downloads that is by default disabled. |
| 48 // Setting |max_download_bytes| to a negative value will disable the limit. |
| 49 // Already running downloads are immediately affected. |
| 50 virtual void SetImageDownloadLimit(int64_t max_download_bytes) = 0; |
| 51 |
| 47 // Sets the desired size for images with multiple frames (like .ico files). | 52 // Sets the desired size for images with multiple frames (like .ico files). |
| 48 // By default, the image fetcher choses smaller images. Override to choose a | 53 // By default, the image fetcher choses smaller images. Override to choose a |
| 49 // frame with a size as close as possible to |size| (trying to take one in | 54 // frame with a size as close as possible to |size| (trying to take one in |
| 50 // larger size if there's no precise match). Passing gfx::Size() as | 55 // larger size if there's no precise match). Passing gfx::Size() as |
| 51 // |size| is also supported and will result in chosing the smallest available | 56 // |size| is also supported and will result in chosing the smallest available |
| 52 // size. | 57 // size. |
| 53 virtual void SetDesiredImageFrameSize(const gfx::Size& size) = 0; | 58 virtual void SetDesiredImageFrameSize(const gfx::Size& size) = 0; |
| 54 | 59 |
| 55 // An empty gfx::Image will be returned to the callback in case the image | 60 // An empty gfx::Image will be returned to the callback in case the image |
| 56 // could not be fetched. | 61 // could not be fetched. |
| 57 virtual void StartOrQueueNetworkRequest( | 62 virtual void StartOrQueueNetworkRequest( |
| 58 const std::string& id, | 63 const std::string& id, |
| 59 const GURL& image_url, | 64 const GURL& image_url, |
| 60 const ImageFetcherCallback& callback) = 0; | 65 const ImageFetcherCallback& callback) = 0; |
| 61 | 66 |
| 62 virtual ImageDecoder* GetImageDecoder() = 0; | 67 virtual ImageDecoder* GetImageDecoder() = 0; |
| 63 | 68 |
| 64 private: | 69 private: |
| 65 DISALLOW_COPY_AND_ASSIGN(ImageFetcher); | 70 DISALLOW_COPY_AND_ASSIGN(ImageFetcher); |
| 66 }; | 71 }; |
| 67 | 72 |
| 68 } // namespace image_fetcher | 73 } // namespace image_fetcher |
| 69 | 74 |
| 70 #endif // COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_H_ | 75 #endif // COMPONENTS_IMAGE_FETCHER_CORE_IMAGE_FETCHER_H_ |
| OLD | NEW |