| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "chrome/browser/icon_loader.h" | 12 #include "chrome/browser/icon_loader.h" |
| 13 | 13 |
| 14 // Helper class for DownloadsGetFileIconFunction. Only used for a single icon | 14 // Helper class for DownloadsGetFileIconFunction. Only used for a single icon |
| 15 // extraction. | 15 // extraction. |
| 16 class DownloadFileIconExtractor { | 16 class DownloadFileIconExtractor { |
| 17 public: | 17 public: |
| 18 // Callback for |ExtractIconForPath|. The parameter is a URL as a string for a | 18 // Callback for |ExtractIconForPath|. The parameter is a URL as a string for a |
| 19 // suitable icon. The string could be empty if the icon could not be | 19 // suitable icon. The string could be empty if the icon could not be |
| 20 // determined. | 20 // determined. |
| 21 typedef base::Callback<void(const std::string&)> IconURLCallback; | 21 typedef base::Callback<void(const std::string&)> IconURLCallback; |
| 22 | 22 |
| 23 virtual ~DownloadFileIconExtractor() {} | 23 virtual ~DownloadFileIconExtractor() {} |
| 24 | 24 |
| 25 // Should return false if the request was invalid. If the return value is | 25 // Should return false if the request was invalid. If the return value is |
| 26 // true, then |callback| should be called with the result. | 26 // true, then |callback| should be called with the result. |
| 27 virtual bool ExtractIconURLForPath(const base::FilePath& path, | 27 virtual bool ExtractIconURLForPath(const base::FilePath& path, |
| 28 float scale, |
| 28 IconLoader::IconSize icon_size, | 29 IconLoader::IconSize icon_size, |
| 29 IconURLCallback callback) = 0; | 30 IconURLCallback callback) = 0; |
| 30 }; | 31 }; |
| 31 | 32 |
| 32 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_ | 33 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_ |
| OLD | NEW |