Home | History | Annotate | Download | only in favicon
      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_FAVICON_FAVICON_HANDLER_DELEGATE_H_
      6 #define CHROME_BROWSER_FAVICON_FAVICON_HANDLER_DELEGATE_H_
      7 
      8 class GURL;
      9 
     10 namespace content {
     11 class NavigationEntry;
     12 }
     13 
     14 // This class provides a delegate interface for a FaviconHandler.  It allows the
     15 // FaviconHandler to ask its delegate for information or notify its delegate
     16 // about changes.
     17 class FaviconHandlerDelegate {
     18  public:
     19   // Returns the current NavigationEntry.
     20   virtual content::NavigationEntry* GetActiveEntry() = 0;
     21 
     22   // Starts the download for the given favicon. When finished, the delegate
     23   // will call OnDidDownloadFavicon() with the results.
     24   // Returns the unique id of the download request. The id will be passed
     25   // in OnDidDownloadFavicon().
     26   // |preferred_image_size| is used to select the size of the returned image if
     27   // the |url| is a multi resolution image.
     28   // |max_image_size| is the maximal size of the image. If the image at |url| is
     29   // bigger than this, it will be resized. 0 means unlimited.
     30   virtual int StartDownload(const GURL& url,
     31                             int preferred_image_size,
     32                             int max_image_size) = 0;
     33 
     34   // Notifies the delegate that the favicon for the active entry was updated.
     35   // |icon_url_changed| is true if a favicon with a different icon URL has
     36   // been selected since the previous call to NotifyFaviconUpdated().
     37   virtual void NotifyFaviconUpdated(bool icon_url_changed) = 0;
     38 };
     39 
     40 #endif  // CHROME_BROWSER_FAVICON_FAVICON_HANDLER_DELEGATE_H_
     41