Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: chrome/browser/favicon/favicon_tab_helper.cc

Issue 10824319: Give SelectFaviconFrames a quality score. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/favicon/favicon_tab_helper.h" 5 #include "chrome/browser/favicon/favicon_tab_helper.h"
6 6
7 #include "chrome/browser/favicon/favicon_handler.h" 7 #include "chrome/browser/favicon/favicon_handler.h"
8 #include "chrome/browser/favicon/favicon_util.h" 8 #include "chrome/browser/favicon/favicon_util.h"
9 #include "chrome/browser/favicon/select_favicon_frames.h" 9 #include "chrome/browser/favicon/select_favicon_frames.h"
10 #include "chrome/browser/history/history.h" 10 #include "chrome/browser/history/history.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 IPC_END_MESSAGE_MAP() 188 IPC_END_MESSAGE_MAP()
189 return message_handled; 189 return message_handled;
190 } 190 }
191 191
192 void FaviconTabHelper::OnDidDownloadFavicon( 192 void FaviconTabHelper::OnDidDownloadFavicon(
193 int id, 193 int id,
194 const GURL& image_url, 194 const GURL& image_url,
195 bool errored, 195 bool errored,
196 int requested_size, 196 int requested_size,
197 const std::vector<SkBitmap>& bitmaps) { 197 const std::vector<SkBitmap>& bitmaps) {
198 float score;
198 // TODO: Possibly do bitmap selection in FaviconHandler, so that it can score 199 // TODO: Possibly do bitmap selection in FaviconHandler, so that it can score
199 // favicons better. 200 // favicons better.
200 std::vector<ui::ScaleFactor> scale_factors; 201 std::vector<ui::ScaleFactor> scale_factors;
201 #if defined(OS_MACOSX) 202 #if defined(OS_MACOSX)
202 scale_factors = ui::GetSupportedScaleFactors(); 203 scale_factors = ui::GetSupportedScaleFactors();
203 #else 204 #else
204 scale_factors.push_back(ui::SCALE_FACTOR_100P); // TODO: Aura? 205 scale_factors.push_back(ui::SCALE_FACTOR_100P); // TODO: Aura?
205 #endif 206 #endif
206 gfx::Image favicon( 207 gfx::Image favicon(SelectFaviconFrames(
207 SelectFaviconFrames(bitmaps, scale_factors, requested_size)); 208 bitmaps, scale_factors, requested_size, &score));
208 favicon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); 209 favicon_handler_->OnDidDownloadFavicon(
209 if (touch_icon_handler_.get()) 210 id, image_url, errored, favicon, score);
210 touch_icon_handler_->OnDidDownloadFavicon(id, image_url, errored, favicon); 211 if (touch_icon_handler_.get()) {
212 touch_icon_handler_->OnDidDownloadFavicon(
213 id, image_url, errored, favicon, score);
214 }
211 } 215 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698