OLD | NEW |
---|---|
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/fav_icon_helper.h" | 5 #include "chrome/browser/fav_icon_helper.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/ref_counted_memory.h" | 10 #include "base/ref_counted_memory.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 if (image.empty()) | 104 if (image.empty()) |
105 return; | 105 return; |
106 | 106 |
107 entry->favicon().set_bitmap(image); | 107 entry->favicon().set_bitmap(image); |
108 tab_contents_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); | 108 tab_contents_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB); |
109 } | 109 } |
110 | 110 |
111 void FavIconHelper::UpdateFavIconURL(RenderViewHost* render_view_host, | 111 void FavIconHelper::UpdateFavIconURL(RenderViewHost* render_view_host, |
112 int32 page_id, | 112 int32 page_id, |
113 const GURL& icon_url) { | 113 const GURL& icon_url) { |
114 // todo(davemoore) Should clear on empty url. Currently we ignore it. | |
brettw
2010/04/26 23:28:33
todo -> TODO
| |
115 // This appears to be what FF does as well. | |
116 if (icon_url.is_empty()) | |
117 return; | |
118 | |
114 NavigationEntry* entry = GetEntry(); | 119 NavigationEntry* entry = GetEntry(); |
115 if (!entry) | 120 if (!entry) |
116 return; | 121 return; |
117 | 122 |
118 got_fav_icon_url_ = true; | 123 got_fav_icon_url_ = true; |
119 | 124 |
120 if (!GetFaviconService()) | 125 if (!GetFaviconService()) |
121 return; | 126 return; |
122 | 127 |
123 if (!fav_icon_expired_ && entry->favicon().is_valid() && | 128 if (!fav_icon_expired_ && entry->favicon().is_valid() && |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 int width = image.width(); | 287 int width = image.width(); |
283 int height = image.height(); | 288 int height = image.height(); |
284 if (width > 0 && height > 0) { | 289 if (width > 0 && height > 0) { |
285 calc_favicon_target_size(&width, &height); | 290 calc_favicon_target_size(&width, &height); |
286 return skia::ImageOperations::Resize( | 291 return skia::ImageOperations::Resize( |
287 image, skia::ImageOperations::RESIZE_LANCZOS3, | 292 image, skia::ImageOperations::RESIZE_LANCZOS3, |
288 width, height); | 293 width, height); |
289 } | 294 } |
290 return image; | 295 return image; |
291 } | 296 } |
OLD | NEW |