| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/extensions/favicon_downloader.h" | 5 #include "chrome/browser/extensions/favicon_downloader.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "components/favicon/content/content_favicon_driver.h" | 8 #include "components/favicon/content/content_favicon_driver.h" |
| 9 #include "content/public/browser/navigation_handle.h" | 9 #include "content/public/browser/navigation_handle.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 return content_favicon_driver ? content_favicon_driver->favicon_urls() | 66 return content_favicon_driver ? content_favicon_driver->favicon_urls() |
| 67 : std::vector<content::FaviconURL>(); | 67 : std::vector<content::FaviconURL>(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void FaviconDownloader::FetchIcons( | 70 void FaviconDownloader::FetchIcons( |
| 71 const std::vector<content::FaviconURL>& favicon_urls) { | 71 const std::vector<content::FaviconURL>& favicon_urls) { |
| 72 std::vector<GURL> urls; | 72 std::vector<GURL> urls; |
| 73 for (std::vector<content::FaviconURL>::const_iterator it = | 73 for (std::vector<content::FaviconURL>::const_iterator it = |
| 74 favicon_urls.begin(); | 74 favicon_urls.begin(); |
| 75 it != favicon_urls.end(); ++it) { | 75 it != favicon_urls.end(); ++it) { |
| 76 if (it->icon_type != content::FaviconURL::INVALID_ICON) | 76 if (it->icon_type != content::FaviconURL::IconType::kInvalid) |
| 77 urls.push_back(it->icon_url); | 77 urls.push_back(it->icon_url); |
| 78 } | 78 } |
| 79 FetchIcons(urls); | 79 FetchIcons(urls); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void FaviconDownloader::FetchIcons(const std::vector<GURL>& urls) { | 82 void FaviconDownloader::FetchIcons(const std::vector<GURL>& urls) { |
| 83 // Download icons; put their download ids into |in_progress_requests_| and | 83 // Download icons; put their download ids into |in_progress_requests_| and |
| 84 // their urls into |processed_urls_|. | 84 // their urls into |processed_urls_|. |
| 85 for (std::vector<GURL>::const_iterator it = urls.begin(); | 85 for (std::vector<GURL>::const_iterator it = urls.begin(); |
| 86 it != urls.end(); ++it) { | 86 it != urls.end(); ++it) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 void FaviconDownloader::DidUpdateFaviconURL( | 127 void FaviconDownloader::DidUpdateFaviconURL( |
| 128 const std::vector<content::FaviconURL>& candidates) { | 128 const std::vector<content::FaviconURL>& candidates) { |
| 129 // Only consider the first candidates we are given. This prevents pages that | 129 // Only consider the first candidates we are given. This prevents pages that |
| 130 // change their favicon from spamming us. | 130 // change their favicon from spamming us. |
| 131 if (!need_favicon_urls_) | 131 if (!need_favicon_urls_) |
| 132 return; | 132 return; |
| 133 | 133 |
| 134 need_favicon_urls_ = false; | 134 need_favicon_urls_ = false; |
| 135 FetchIcons(candidates); | 135 FetchIcons(candidates); |
| 136 } | 136 } |
| OLD | NEW |