| OLD | NEW |
| 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 "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIconURL.h" |
| 11 #include "ui/gfx/codec/png_codec.h" | 12 #include "ui/gfx/codec/png_codec.h" |
| 12 #include "ui/gfx/image/image_png_rep.h" | 13 #include "ui/gfx/image/image_png_rep.h" |
| 13 #include "ui/gfx/image/image_skia.h" | 14 #include "ui/gfx/image/image_skia.h" |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 // Creates image reps of DIP size |favicon_size| for the subset of | 18 // Creates image reps of DIP size |favicon_size| for the subset of |
| 18 // |scale_factors| for which the image reps can be created without resizing | 19 // |scale_factors| for which the image reps can be created without resizing |
| 19 // or decoding the bitmap data. | 20 // or decoding the bitmap data. |
| 20 std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing( | 21 std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing( |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 int desired_size) { | 178 int desired_size) { |
| 178 std::vector<gfx::Size> sizes; | 179 std::vector<gfx::Size> sizes; |
| 179 for (size_t i = 0; i < bitmaps.size(); ++i) | 180 for (size_t i = 0; i < bitmaps.size(); ++i) |
| 180 sizes.push_back(gfx::Size(bitmaps[i].width(), bitmaps[i].height())); | 181 sizes.push_back(gfx::Size(bitmaps[i].width(), bitmaps[i].height())); |
| 181 std::vector<size_t> selected_bitmap_indices; | 182 std::vector<size_t> selected_bitmap_indices; |
| 182 SelectFaviconFrameIndices(sizes, scale_factors, desired_size, | 183 SelectFaviconFrameIndices(sizes, scale_factors, desired_size, |
| 183 &selected_bitmap_indices, NULL); | 184 &selected_bitmap_indices, NULL); |
| 184 DCHECK_EQ(1u, selected_bitmap_indices.size()); | 185 DCHECK_EQ(1u, selected_bitmap_indices.size()); |
| 185 return selected_bitmap_indices[0]; | 186 return selected_bitmap_indices[0]; |
| 186 } | 187 } |
| OLD | NEW |