summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_file_icon_extractor.h
blob: 454790a23c9a5086cd6963944b53196ff7af7255 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_
#define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_

#include <string>

#include "base/callback.h"
#include "base/files/file_path.h"
#include "chrome/browser/icon_loader.h"

// Helper class for DownloadsGetFileIconFunction. Only used for a single icon
// extraction.
class DownloadFileIconExtractor {
 public:
  // Callback for |ExtractIconForPath|. The parameter is a URL as a string for a
  // suitable icon. The string could be empty if the icon could not be
  // determined.
  typedef base::Callback<void(const std::string&)> IconURLCallback;

  virtual ~DownloadFileIconExtractor() {}

  // Should return false if the request was invalid.  If the return value is
  // true, then |callback| should be called with the result.
  virtual bool ExtractIconURLForPath(const base::FilePath& path,
                                     float scale,
                                     IconLoader::IconSize icon_size,
                                     IconURLCallback callback) = 0;
};

#endif  // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_FILE_ICON_EXTRACTOR_H_