| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "content/public/browser/reload_type.h" |
| 14 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
| 15 #include "url/gurl.h" | 16 #include "url/gurl.h" |
| 16 | 17 |
| 17 class SkBitmap; | 18 class SkBitmap; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 struct FaviconURL; | 21 struct FaviconURL; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace gfx { | 24 namespace gfx { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 43 explicit IconHelper(content::WebContents* web_contents); | 44 explicit IconHelper(content::WebContents* web_contents); |
| 44 ~IconHelper() override; | 45 ~IconHelper() override; |
| 45 | 46 |
| 46 void SetListener(Listener* listener); | 47 void SetListener(Listener* listener); |
| 47 | 48 |
| 48 // From WebContentsObserver | 49 // From WebContentsObserver |
| 49 void DidUpdateFaviconURL( | 50 void DidUpdateFaviconURL( |
| 50 const std::vector<content::FaviconURL>& candidates) override; | 51 const std::vector<content::FaviconURL>& candidates) override; |
| 51 void DidStartNavigationToPendingEntry( | 52 void DidStartNavigationToPendingEntry( |
| 52 const GURL& url, | 53 const GURL& url, |
| 53 content::NavigationController::ReloadType reload_type) override; | 54 content::ReloadType reload_type) override; |
| 54 | 55 |
| 55 void DownloadFaviconCallback( | 56 void DownloadFaviconCallback( |
| 56 int id, | 57 int id, |
| 57 int http_status_code, | 58 int http_status_code, |
| 58 const GURL& image_url, | 59 const GURL& image_url, |
| 59 const std::vector<SkBitmap>& bitmaps, | 60 const std::vector<SkBitmap>& bitmaps, |
| 60 const std::vector<gfx::Size>& original_bitmap_sizes); | 61 const std::vector<gfx::Size>& original_bitmap_sizes); |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 void MarkUnableToDownloadFavicon(const GURL& icon_url); | 64 void MarkUnableToDownloadFavicon(const GURL& icon_url); |
| 64 bool WasUnableToDownloadFavicon(const GURL& icon_url) const; | 65 bool WasUnableToDownloadFavicon(const GURL& icon_url) const; |
| 65 void ClearUnableToDownloadFavicons(); | 66 void ClearUnableToDownloadFavicons(); |
| 66 | 67 |
| 67 Listener* listener_; | 68 Listener* listener_; |
| 68 | 69 |
| 69 typedef uint32_t MissingFaviconURLHash; | 70 typedef uint32_t MissingFaviconURLHash; |
| 70 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; | 71 base::hash_set<MissingFaviconURLHash> missing_favicon_urls_; |
| 71 | 72 |
| 72 DISALLOW_COPY_AND_ASSIGN(IconHelper); | 73 DISALLOW_COPY_AND_ASSIGN(IconHelper); |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 } // namespace android_webview | 76 } // namespace android_webview |
| 76 | 77 |
| 77 #endif // ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_ | 78 #endif // ANDROID_WEBVIEW_BROWSER_ICON_HELPER_H_ |
| OLD | NEW |