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 #include "android_webview/browser/icon_helper.h" | 5 #include "android_webview/browser/icon_helper.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 switch(i->icon_type) { | 68 switch(i->icon_type) { |
69 case content::FaviconURL::FAVICON: | 69 case content::FaviconURL::FAVICON: |
70 if ((listener_ && !listener_->ShouldDownloadFavicon(i->icon_url)) || | 70 if ((listener_ && !listener_->ShouldDownloadFavicon(i->icon_url)) || |
71 WasUnableToDownloadFavicon(i->icon_url)) { | 71 WasUnableToDownloadFavicon(i->icon_url)) { |
72 break; | 72 break; |
73 } | 73 } |
74 web_contents()->DownloadImage(i->icon_url, | 74 web_contents()->DownloadImage(i->icon_url, |
75 true, // Is a favicon | 75 true, // Is a favicon |
76 0, // No maximum size | 76 0, // No maximum size |
| 77 false, // Normal cache policy |
77 base::Bind( | 78 base::Bind( |
78 &IconHelper::DownloadFaviconCallback, base::Unretained(this))); | 79 &IconHelper::DownloadFaviconCallback, base::Unretained(this))); |
79 break; | 80 break; |
80 case content::FaviconURL::TOUCH_ICON: | 81 case content::FaviconURL::TOUCH_ICON: |
81 if (listener_) | 82 if (listener_) |
82 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), false); | 83 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), false); |
83 break; | 84 break; |
84 case content::FaviconURL::TOUCH_PRECOMPOSED_ICON: | 85 case content::FaviconURL::TOUCH_PRECOMPOSED_ICON: |
85 if (listener_) | 86 if (listener_) |
86 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), true); | 87 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), true); |
(...skipping 23 matching lines...) Expand all Loading... |
110 bool IconHelper::WasUnableToDownloadFavicon(const GURL& icon_url) const { | 111 bool IconHelper::WasUnableToDownloadFavicon(const GURL& icon_url) const { |
111 MissingFaviconURLHash url_hash = base::Hash(icon_url.spec()); | 112 MissingFaviconURLHash url_hash = base::Hash(icon_url.spec()); |
112 return missing_favicon_urls_.find(url_hash) != missing_favicon_urls_.end(); | 113 return missing_favicon_urls_.find(url_hash) != missing_favicon_urls_.end(); |
113 } | 114 } |
114 | 115 |
115 void IconHelper::ClearUnableToDownloadFavicons() { | 116 void IconHelper::ClearUnableToDownloadFavicons() { |
116 missing_favicon_urls_.clear(); | 117 missing_favicon_urls_.clear(); |
117 } | 118 } |
118 | 119 |
119 } // namespace android_webview | 120 } // namespace android_webview |
OLD | NEW |