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, 0, base::Bind( | 62 web_contents()->DownloadFavicon(i->icon_url, |
63 &IconHelper::DownloadFaviconCallback, base::Unretained(this))); | 63 true, // favicon |
jam
2013/03/20 02:44:42
ditto
| |
64 0, | |
65 base::Bind( | |
66 &IconHelper::DownloadFaviconCallback, base::Unretained(this))); | |
64 break; | 67 break; |
65 case content::FaviconURL::TOUCH_ICON: | 68 case content::FaviconURL::TOUCH_ICON: |
66 if (listener_) | 69 if (listener_) |
67 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), false); | 70 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), false); |
68 break; | 71 break; |
69 case content::FaviconURL::TOUCH_PRECOMPOSED_ICON: | 72 case content::FaviconURL::TOUCH_PRECOMPOSED_ICON: |
70 if (listener_) | 73 if (listener_) |
71 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), true); | 74 listener_->OnReceivedTouchIconUrl(i->icon_url.spec(), true); |
72 break; | 75 break; |
73 case content::FaviconURL::INVALID_ICON: | 76 case content::FaviconURL::INVALID_ICON: |
74 // Silently ignore it. Only trigger a callback on valid icons. | 77 // Silently ignore it. Only trigger a callback on valid icons. |
75 break; | 78 break; |
76 default: | 79 default: |
77 NOTREACHED(); | 80 NOTREACHED(); |
78 break; | 81 break; |
79 } | 82 } |
80 } | 83 } |
81 } | 84 } |
82 | 85 |
83 } // namespace android_webview | 86 } // namespace android_webview |
OLD | NEW |