Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / android_webview / browser / icon_helper.h
blobe684cdf569674b9685f45d0b005a7198c387fbef
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_
8 #include <string>
9 #include "content/public/browser/web_contents_observer.h"
11 class SkBitmap;
13 namespace content {
14 struct FaviconURL;
17 namespace android_webview {
19 // A helper that observes favicon changes for Webview.
20 class IconHelper : public content::WebContentsObserver {
21 public:
22 class Listener {
23 public:
24 virtual void OnReceivedIcon(const SkBitmap& bitmap) = 0;
25 virtual void OnReceivedTouchIconUrl(const std::string& url,
26 const bool precomposed) = 0;
27 protected:
28 virtual ~Listener() {}
31 explicit IconHelper(content::WebContents* web_contents);
32 virtual ~IconHelper();
34 void SetListener(Listener* listener);
36 // From WebContentsObserver
37 virtual void DidUpdateFaviconURL(int32 page_id,
38 const std::vector<content::FaviconURL>& candidates) OVERRIDE;
40 void DownloadFaviconCallback(int id, const GURL& image_url,
41 int requested_size, const std::vector<SkBitmap>& bitmaps);
43 private:
44 Listener* listener_;
46 DISALLOW_COPY_AND_ASSIGN(IconHelper);
49 } // namespace android_webview
51 #endif // ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_