Chromium Code Reviews| Index: chrome/browser/favicon/favicon_download_helper.h |
| diff --git a/chrome/browser/favicon/favicon_download_helper.h b/chrome/browser/favicon/favicon_download_helper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5a5c06c1e8fd8f753018dcafbee49f2463bf01bf |
| --- /dev/null |
| +++ b/chrome/browser/favicon/favicon_download_helper.h |
| @@ -0,0 +1,71 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ |
| +#define CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ |
| + |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "content/public/browser/web_contents_observer.h" |
| + |
| +namespace content { |
| +class WebContents; |
| +} |
| + |
| +namespace gfx { |
| +class Image; |
| +} |
| + |
| +class GURL; |
| +class FaviconDownloadHelperDelegate; |
| +class SkBitmap; |
| + |
| +// FaviconDownloadHelper handles requests to download favicons, and listens for |
| +// the IPC messages from the renderer. |
| +// |
| +class FaviconDownloadHelper |
| + : public content::WebContentsObserver, |
| + public base::RefCounted<FaviconDownloadHelper> { |
| + |
| + public: |
| + static void CreateForWebContentsAndDelegate( |
| + content::WebContents* contents, |
| + FaviconDownloadHelperDelegate* delegate); |
| + |
| + static FaviconDownloadHelper* FromWebContents(content::WebContents* contents); |
| + |
| + |
|
Jói
2012/10/18 10:31:37
Just one blank line
Cait (Slow)
2012/10/18 15:02:47
Done.
|
| + // Download the favicon at |url|. Returns the unique id of the download |
| + // request. The id will be sent in the IPC message. |
|
Jói
2012/10/18 10:31:37
More relevant to this interface, is "The id will b
Cait (Slow)
2012/10/18 15:02:47
Done.
|
| + int DownloadFavicon(const GURL& url, int image_size); |
| + |
| + protected: |
| + friend class base::RefCounted<FaviconDownloadHelper>; |
| + |
| + FaviconDownloadHelper(content::WebContents* web_contents, |
| + FaviconDownloadHelperDelegate* delegate); |
| + |
| + virtual ~FaviconDownloadHelper(); |
| + |
| + // content::WebContentsObserver overrides. |
| + virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| + |
| + // Message handler for IconHostMsg_DidDownloadFavicon. Called when the icon |
| + // at |image_url| has been downloaded. |
| + // |bitmaps| is a list of all the frames of the icon at |image_url|. |
| + void OnDidDownloadFavicon(int id, |
| + const GURL& image_url, |
| + bool errored, |
| + int requested_size, |
| + const std::vector<SkBitmap>& bitmaps); |
| + |
| + private: |
| + // Delegate to pass Favicon bitmaps back to. Weak. |
| + FaviconDownloadHelperDelegate* delegate_; |
| + DISALLOW_COPY_AND_ASSIGN(FaviconDownloadHelper); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ |