1 // Copyright (c) 2013 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 ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_
6 #define ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_
9 #include "content/public/browser/web_contents_observer.h"
22 namespace android_webview
{
24 // A helper that observes favicon changes for Webview.
25 class IconHelper
: public content::WebContentsObserver
{
29 virtual bool ShouldDownloadFavicon(const GURL
& icon_url
) = 0;
30 virtual void OnReceivedIcon(const GURL
& icon_url
,
31 const SkBitmap
& bitmap
) = 0;
32 virtual void OnReceivedTouchIconUrl(const std::string
& url
,
33 const bool precomposed
) = 0;
35 virtual ~Listener() {}
38 explicit IconHelper(content::WebContents
* web_contents
);
39 virtual ~IconHelper();
41 void SetListener(Listener
* listener
);
43 // From WebContentsObserver
44 virtual void DidUpdateFaviconURL(int32 page_id
,
45 const std::vector
<content::FaviconURL
>& candidates
) OVERRIDE
;
47 void DownloadFaviconCallback(
50 const GURL
& image_url
,
51 const std::vector
<SkBitmap
>& bitmaps
,
52 const std::vector
<gfx::Size
>& original_bitmap_sizes
);
57 DISALLOW_COPY_AND_ASSIGN(IconHelper
);
60 } // namespace android_webview
62 #endif // ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_