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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_
6 #define COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_
8 #include <base/macros.h>
18 // Interface that allows Favicon core code to interact with its driver (i.e.,
19 // obtain information from it and give information to it). A concrete
20 // implementation must be provided by the driver.
23 // Starts the download for the given favicon. When finished, the driver
24 // will call OnDidDownloadFavicon() with the results.
25 // Returns the unique id of the download request. The id will be passed
26 // in OnDidDownloadFavicon().
27 // Bitmaps with pixel sizes larger than |max_bitmap_size| are filtered out
28 // from the bitmap results. If there are no bitmap results <=
29 // |max_bitmap_size|, the smallest bitmap is resized to |max_bitmap_size| and
30 // is the only result. A |max_bitmap_size| of 0 means unlimited.
31 virtual int StartDownload(const GURL
& url
, int max_bitmap_size
) = 0;
33 // Returns whether the user is operating in an off-the-record context.
34 virtual bool IsOffTheRecord() = 0;
36 // Returns whether |url| is bookmarked.
37 virtual bool IsBookmarked(const GURL
& url
) = 0;
39 // Returns the bitmap of the current page's favicon. Requires GetActiveURL()
41 virtual const gfx::Image
GetActiveFaviconImage() = 0;
43 // Returns the URL of the current page's favicon. Requires GetActiveURL() to
45 virtual const GURL
GetActiveFaviconURL() = 0;
47 // Returns whether the page's favicon is valid (returns false if the default
48 // favicon is being used). Requires GetActiveURL() to be valid.
49 virtual bool GetActiveFaviconValidity() = 0;
51 // Returns the URL of the current page, if any. Returns an invalid
53 virtual const GURL
GetActiveURL() = 0;
55 // Notifies the driver a favicon image is available. |image| is not
56 // necessarily 16x16. |icon_url| is the url the image is from. If
57 // |is_active_favicon| is true the image corresponds to the favicon
58 // (possibly empty) of the page.
59 virtual void OnFaviconAvailable(const gfx::Image
& image
,
61 bool is_active_favicon
) = 0;
65 virtual ~FaviconDriver() {}
68 DISALLOW_COPY_AND_ASSIGN(FaviconDriver
);
71 } // namespace favicon
73 #endif // COMPONENTS_FAVICON_CORE_FAVICON_DRIVER_H_