| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include "base/containers/hash_tables.h" |
| 9 #include "content/public/browser/web_contents_observer.h" | 10 #include "content/public/browser/web_contents_observer.h" |
| 10 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 11 | 12 |
| 12 class SkBitmap; | 13 class SkBitmap; |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 struct FaviconURL; | 16 struct FaviconURL; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace gfx { | 19 namespace gfx { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 explicit IconHelper(content::WebContents* web_contents); | 39 explicit IconHelper(content::WebContents* web_contents); |
| 39 virtual ~IconHelper(); | 40 virtual ~IconHelper(); |
| 40 | 41 |
| 41 void SetListener(Listener* listener); | 42 void SetListener(Listener* listener); |
| 42 | 43 |
| 43 // From WebContentsObserver | 44 // From WebContentsObserver |
| 44 virtual void DidUpdateFaviconURL(int32 page_id, | 45 virtual void DidUpdateFaviconURL(int32 page_id, |
| 45 const std::vector<content::FaviconURL>& candidates) OVERRIDE; | 46 const std::vector<content::FaviconURL>& candidates) OVERRIDE; |
| 47 virtual void DidStartNavigationToPendingEntry( |
| 48 const GURL& url, |
| 49 content::NavigationController::ReloadType reload_type) OVERRIDE; |
| 46 | 50 |
| 47 void DownloadFaviconCallback( | 51 void DownloadFaviconCallback( |
| 48 int id, | 52 int id, |
| 49 int http_status_code, | 53 int http_status_code, |
| 50 const GURL& image_url, | 54 const GURL& image_url, |
| 51 const std::vector<SkBitmap>& bitmaps, | 55 const std::vector<SkBitmap>& bitmaps, |
| 52 const std::vector<gfx::Size>& original_bitmap_sizes); | 56 const std::vector<gfx::Size>& original_bitmap_sizes); |
| 53 | 57 |
| 54 private: | 58 private: |
| 59 void MarkUnableToDownloadFavicon(const GURL& icon_url); |
| 60 bool WasUnableToDownloadFavicon(const GURL& icon_url) const; |
| 61 void ClearUnableToDownloadFavicons(); |
| 62 |
| 55 Listener* listener_; | 63 Listener* listener_; |
| 56 | 64 |
| 65 typedef uint32 MissingFaviconURLHash; |
| 66 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; |
| 67 |
| 57 DISALLOW_COPY_AND_ASSIGN(IconHelper); | 68 DISALLOW_COPY_AND_ASSIGN(IconHelper); |
| 58 }; | 69 }; |
| 59 | 70 |
| 60 } // namespace android_webview | 71 } // namespace android_webview |
| 61 | 72 |
| 62 #endif // ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_ | 73 #endif // ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_ |
| OLD | NEW |