Home | History | Annotate | Download | only in launcher
      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_UI_ASH_LAUNCHER_LAUNCHER_FAVICON_LOADER_H_
      6 #define CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_FAVICON_LOADER_H_
      7 
      8 #include <vector>
      9 
     10 #include "base/basictypes.h"
     11 #include "base/callback.h"
     12 #include "content/public/common/favicon_url.h"
     13 
     14 class GURL;
     15 class SkBitmap;
     16 
     17 namespace internal {
     18 class FaviconBitmapHandler;
     19 }
     20 
     21 namespace content {
     22 class WebContents;
     23 }
     24 
     25 // LauncherFaviconLoader handles updates to the list of favicon urls and
     26 // retrieves the appropriately sized favicon for panels in the Launcher.
     27 
     28 class LauncherFaviconLoader {
     29  public:
     30   class Delegate {
     31    public:
     32     virtual void FaviconUpdated() = 0;
     33 
     34    protected:
     35     virtual ~Delegate() {}
     36   };
     37 
     38   LauncherFaviconLoader(Delegate* delegate,
     39                         content::WebContents* web_contents);
     40   virtual ~LauncherFaviconLoader();
     41 
     42   content::WebContents* web_contents() {
     43     return web_contents_;
     44   }
     45 
     46   // Returns an appropriately sized favicon for the Launcher. If none are
     47   // available will return an isNull bitmap.
     48   SkBitmap GetFavicon() const;
     49 
     50   // Returns true if the loader is waiting for downloads to finish.
     51   bool HasPendingDownloads() const;
     52 
     53  private:
     54   content::WebContents* web_contents_;
     55   scoped_ptr<internal::FaviconBitmapHandler> favicon_handler_;
     56 
     57   DISALLOW_COPY_AND_ASSIGN(LauncherFaviconLoader);
     58 };
     59 
     60 #endif  // CHROME_BROWSER_UI_ASH_LAUNCHER_LAUNCHER_FAVICON_LOADER_H_
     61