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