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

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

Issue 11421051: Remove FaviconUtil::DownloadFavicon (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« no previous file with comments | « chrome/browser/favicon/favicon_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_util.h" 5 #include "chrome/browser/favicon/favicon_util.h"
6 6
7 #include "chrome/browser/history/history_types.h" 7 #include "chrome/browser/history/history_types.h"
8 #include "chrome/browser/history/select_favicon_frames.h" 8 #include "chrome/browser/history/select_favicon_frames.h"
9 #include "chrome/common/icon_messages.h" 9 #include "chrome/common/icon_messages.h"
10 #include "content/public/browser/render_view_host.h" 10 #include "content/public/browser/render_view_host.h"
(...skipping 19 matching lines...) Expand all
30 insert_index = i; 30 insert_index = i;
31 break; 31 break;
32 } 32 }
33 } 33 }
34 favicon_scale_factors.insert(favicon_scale_factors.begin() + insert_index, 34 favicon_scale_factors.insert(favicon_scale_factors.begin() + insert_index,
35 ui::SCALE_FACTOR_100P); 35 ui::SCALE_FACTOR_100P);
36 return favicon_scale_factors; 36 return favicon_scale_factors;
37 } 37 }
38 38
39 // static 39 // static
40 int FaviconUtil::DownloadFavicon(content::RenderViewHost* rvh,
41 const GURL& url,
42 int image_size) {
43 static int id = 0;
44 rvh->Send(new IconMsg_DownloadFavicon(rvh->GetRoutingID(), ++id, url,
45 image_size));
46 return id;
47 }
48 // static
49 gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs( 40 gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs(
50 const std::vector<history::FaviconBitmapResult>& png_data, 41 const std::vector<history::FaviconBitmapResult>& png_data,
51 const std::vector<ui::ScaleFactor> scale_factors, 42 const std::vector<ui::ScaleFactor> scale_factors,
52 int favicon_size) { 43 int favicon_size) {
53 std::vector<SkBitmap> bitmaps; 44 std::vector<SkBitmap> bitmaps;
54 for (size_t i = 0; i < png_data.size(); ++i) { 45 for (size_t i = 0; i < png_data.size(); ++i) {
55 if (!png_data[i].is_valid()) 46 if (!png_data[i].is_valid())
56 continue; 47 continue;
57 48
58 SkBitmap bitmap; 49 SkBitmap bitmap;
(...skipping 19 matching lines...) Expand all
78 int desired_size) { 69 int desired_size) {
79 std::vector<gfx::Size> sizes; 70 std::vector<gfx::Size> sizes;
80 for (size_t i = 0; i < bitmaps.size(); ++i) 71 for (size_t i = 0; i < bitmaps.size(); ++i)
81 sizes.push_back(gfx::Size(bitmaps[i].width(), bitmaps[i].height())); 72 sizes.push_back(gfx::Size(bitmaps[i].width(), bitmaps[i].height()));
82 std::vector<size_t> selected_bitmap_indices; 73 std::vector<size_t> selected_bitmap_indices;
83 SelectFaviconFrameIndices(sizes, scale_factors, desired_size, 74 SelectFaviconFrameIndices(sizes, scale_factors, desired_size,
84 &selected_bitmap_indices, NULL); 75 &selected_bitmap_indices, NULL);
85 DCHECK_EQ(1u, selected_bitmap_indices.size()); 76 DCHECK_EQ(1u, selected_bitmap_indices.size());
86 return selected_bitmap_indices[0]; 77 return selected_bitmap_indices[0];
87 } 78 }
OLDNEW
« no previous file with comments | « chrome/browser/favicon/favicon_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698