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
3// found in the LICENSE file.
4
5#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_
6#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_
7
8#include <string>
9
10#include "base/callback.h"
11#include "base/files/file_path.h"
12#include "chrome/browser/icon_loader.h"
13
14// Helper class for DownloadsGetFileIconFunction. Only used for a single icon
15// extraction.
16class DownloadFileIconExtractor {
17 public:
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
20  // determined.
21  typedef base::Callback<void(const std::string&)> IconURLCallback;
22
23  virtual ~DownloadFileIconExtractor() {}
24
25  // Should return false if the request was invalid.  If the return value is
26  // true, then |callback| should be called with the result.
27  virtual bool ExtractIconURLForPath(const base::FilePath& path,
28                                     float scale,
29                                     IconLoader::IconSize icon_size,
30                                     IconURLCallback callback) = 0;
31};
32
33#endif  // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_
34