Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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_DOWNLOAD_HELPER_H_ | |
| 6 #define CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/callback.h" | |
| 12 #include "chrome/common/favicon_url.h" | |
|
Jói
2012/10/16 21:56:52
Is favicon_url.h free of other dependencies?
Once
Cait (Slow)
2012/10/17 16:00:42
Agree. Looking into breaking the remaining DEPS fo
| |
| 13 #include "content/public/browser/web_contents_observer.h" | |
| 14 #include "content/public/browser/web_contents_user_data.h" | |
| 15 | |
| 16 namespace gfx { | |
| 17 class Image; | |
| 18 } | |
| 19 | |
| 20 class GURL; | |
| 21 class FaviconDownloadDelegate; | |
| 22 class SkBitmap; | |
| 23 | |
| 24 // FaviconDownloadHelper handles requests to download favicons, and listens for | |
| 25 // the IPC messages from the renderer. | |
| 26 // | |
| 27 class FaviconDownloadHelper : public content::WebContentsObserver, | |
|
Jói
2012/10/16 21:56:52
indent like this
class FaviconDownloadHelper
Cait (Slow)
2012/10/17 16:00:42
Done.
| |
| 28 public content::WebContentsUserData<FaviconDownloadHelper> { | |
| 29 public: | |
| 30 virtual ~FaviconDownloadHelper(); | |
| 31 | |
| 32 // Download the favicon at |url|. | |
| 33 int DownloadFavicon(const GURL& url, int image_size); | |
|
Jói
2012/10/16 21:56:52
Need to document the return value is the 'id' you
Cait (Slow)
2012/10/17 16:00:42
Done.
| |
| 34 | |
| 35 // Set our external delegate. | |
| 36 void SetExternalDelegate(FaviconDownloadDelegate* delegate) { | |
| 37 external_delegate_ = delegate; | |
| 38 } | |
| 39 | |
| 40 // content::WebContentsObserver overrides. | |
| 41 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
|
Jói
2012/10/16 21:56:52
I think this can be protected; likewise OnDidDownl
Cait (Slow)
2012/10/17 16:00:42
Done.
| |
| 42 | |
| 43 // Message handler for IconHostMsg_DidDownloadFavicon. Called when the icon | |
| 44 // at |image_url| has been downloaded. | |
| 45 // |bitmaps| is a list of all the frames of the icon at |image_url|. | |
| 46 void OnDidDownloadFavicon(int id, | |
| 47 const GURL& image_url, | |
| 48 bool errored, | |
| 49 int requested_size, | |
| 50 const std::vector<SkBitmap>& bitmaps); | |
| 51 | |
| 52 // Delegate to pass Favicon bitmaps back to. Weak. | |
| 53 FaviconDownloadDelegate* external_delegate_; | |
|
Jói
2012/10/16 21:56:52
Should be private. Can name it just delegate_.
Cait (Slow)
2012/10/17 16:00:42
Done.
| |
| 54 | |
| 55 private: | |
| 56 explicit FaviconDownloadHelper(content::WebContents* web_contents); | |
|
Jói
2012/10/16 21:56:52
You could follow the example of AutofillManager::C
Cait (Slow)
2012/10/17 16:00:42
Done.
| |
| 57 friend class content::WebContentsUserData<FaviconDownloadHelper>; | |
| 58 DISALLOW_COPY_AND_ASSIGN(FaviconDownloadHelper); | |
| 59 }; | |
| 60 | |
| 61 #endif // CHROME_BROWSER_FAVICON_FAVICON_DOWNLOAD_HELPER_H_ | |
| OLD | NEW |