OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/web_applications/update_shortcut_worker_win.h" | 5 #include "chrome/browser/web_applications/update_shortcut_worker_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 int requested_size, | 99 int requested_size, |
100 int id, | 100 int id, |
101 int http_status_code, | 101 int http_status_code, |
102 const GURL& image_url, | 102 const GURL& image_url, |
103 const std::vector<SkBitmap>& bitmaps, | 103 const std::vector<SkBitmap>& bitmaps, |
104 const std::vector<gfx::Size>& original_sizes) { | 104 const std::vector<gfx::Size>& original_sizes) { |
105 std::vector<int> requested_sizes_in_pixel; | 105 std::vector<int> requested_sizes_in_pixel; |
106 requested_sizes_in_pixel.push_back(requested_size); | 106 requested_sizes_in_pixel.push_back(requested_size); |
107 | 107 |
108 std::vector<size_t> closest_indices; | 108 std::vector<size_t> closest_indices; |
109 SelectFaviconFrameIndices(original_sizes, | 109 SelectFaviconFrameIndices( |
110 requested_sizes_in_pixel, | 110 original_sizes, requested_sizes_in_pixel, &closest_indices, NULL); |
111 &closest_indices, | |
112 NULL); | |
113 | 111 |
114 SkBitmap bitmap; | 112 SkBitmap bitmap; |
115 if (!bitmaps.empty()) { | 113 if (!bitmaps.empty()) { |
116 size_t closest_index = closest_indices[0]; | 114 size_t closest_index = closest_indices[0]; |
117 bitmap = bitmaps[closest_index]; | 115 bitmap = bitmaps[closest_index]; |
118 } | 116 } |
119 | 117 |
120 if (!bitmap.isNull()) { | 118 if (!bitmap.isNull()) { |
121 // Update icon with download image and update shortcut. | 119 // Update icon with download image and update shortcut. |
122 shortcut_info_.favicon.Add(gfx::Image::CreateFrom1xBitmap(bitmap)); | 120 shortcut_info_.favicon.Add(gfx::Image::CreateFrom1xBitmap(bitmap)); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 base::Unretained(this))); | 234 base::Unretained(this))); |
237 } | 235 } |
238 } | 236 } |
239 | 237 |
240 void UpdateShortcutWorker::DeleteMeOnUIThread() { | 238 void UpdateShortcutWorker::DeleteMeOnUIThread() { |
241 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 239 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
242 delete this; | 240 delete this; |
243 } | 241 } |
244 | 242 |
245 } // namespace web_app | 243 } // namespace web_app |
OLD | NEW |