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 "chrome/browser/favicon/favicon_tab_helper.h" | 8 #include "chrome/browser/favicon/favicon_tab_helper.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/common/favicon_url.h" | 10 #include "content/public/common/favicon_url.h" |
11 #include "third_party/skia/include/core/SkBitmap.h" | 11 #include "third_party/skia/include/core/SkBitmap.h" |
12 #include "ui/gfx/size.h" | 12 #include "ui/gfx/geometry/size.h" |
13 | 13 |
14 FaviconDownloader::FaviconDownloader( | 14 FaviconDownloader::FaviconDownloader( |
15 content::WebContents* web_contents, | 15 content::WebContents* web_contents, |
16 const std::vector<GURL>& extra_favicon_urls, | 16 const std::vector<GURL>& extra_favicon_urls, |
17 FaviconDownloaderCallback callback) | 17 FaviconDownloaderCallback callback) |
18 : content::WebContentsObserver(web_contents), | 18 : content::WebContentsObserver(web_contents), |
19 got_favicon_urls_(false), | 19 got_favicon_urls_(false), |
20 extra_favicon_urls_(extra_favicon_urls), | 20 extra_favicon_urls_(extra_favicon_urls), |
21 callback_(callback), | 21 callback_(callback), |
22 weak_ptr_factory_(this) { | 22 weak_ptr_factory_(this) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 void FaviconDownloader::DidUpdateFaviconURL( | 114 void FaviconDownloader::DidUpdateFaviconURL( |
115 const std::vector<content::FaviconURL>& candidates) { | 115 const std::vector<content::FaviconURL>& candidates) { |
116 // Only consider the first candidates we are given. This prevents pages that | 116 // Only consider the first candidates we are given. This prevents pages that |
117 // change their favicon from spamming us. | 117 // change their favicon from spamming us. |
118 if (got_favicon_urls_) | 118 if (got_favicon_urls_) |
119 return; | 119 return; |
120 | 120 |
121 got_favicon_urls_ = true; | 121 got_favicon_urls_ = true; |
122 FetchIcons(candidates); | 122 FetchIcons(candidates); |
123 } | 123 } |
OLD | NEW |