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/logging.h" | 9 #include "base/logging.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 for (std::vector<content::FaviconURL>::const_iterator i = candidates.begin(); | 52 for (std::vector<content::FaviconURL>::const_iterator i = candidates.begin(); |
53 i != candidates.end(); ++i) { | 53 i != candidates.end(); ++i) { |
54 if (!i->icon_url.is_valid()) | 54 if (!i->icon_url.is_valid()) |
55 continue; | 55 continue; |
56 | 56 |
57 switch(i->icon_type) { | 57 switch(i->icon_type) { |
58 case content::FaviconURL::FAVICON: | 58 case content::FaviconURL::FAVICON: |
59 // TODO(acleung): only fetch the URL if favicon downloading is enabled. | 59 // TODO(acleung): only fetch the URL if favicon downloading is enabled. |
60 // (currently that is, the app has called WebIconDatabase.open() | 60 // (currently that is, the app has called WebIconDatabase.open() |
61 // but we should decouple that setting via a boolean setting) | 61 // but we should decouple that setting via a boolean setting) |
62 web_contents()->DownloadFavicon(i->icon_url, | 62 web_contents()->DownloadImage(i->icon_url, |
63 true, | 63 true, |
64 0, | 64 0, |
65 base::Bind( | 65 base::Bind( |
66 &IconHelper::DownloadFaviconCallback, base::Unretained(this))); | 66 &IconHelper::DownloadFaviconCallback, base::Unretained(this))); |
67 break; | 67 break; |
68 case content::FaviconURL::TOUCH_ICON: | 68 case content::FaviconURL::TOUCH_ICON: |
69 if (listener_) | 69 if (listener_) |
70 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), false); | 70 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), false); |
71 break; | 71 break; |
72 case content::FaviconURL::TOUCH_PRECOMPOSED_ICON: | 72 case content::FaviconURL::TOUCH_PRECOMPOSED_ICON: |
73 if (listener_) | 73 if (listener_) |
74 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), true); | 74 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), true); |
75 break; | 75 break; |
76 case content::FaviconURL::INVALID_ICON: | 76 case content::FaviconURL::INVALID_ICON: |
77 // Silently ignore it. Only trigger a callback on valid icons. | 77 // Silently ignore it. Only trigger a callback on valid icons. |
78 break; | 78 break; |
79 default: | 79 default: |
80 NOTREACHED(); | 80 NOTREACHED(); |
81 break; | 81 break; |
82 } | 82 } |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 } // namespace android_webview | 86 } // namespace android_webview |
OLD | NEW |