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/ui/web_applications/web_app_ui.h" | 5 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 virtual void Observe(int type, | 82 virtual void Observe(int type, |
83 const content::NotificationSource& source, | 83 const content::NotificationSource& source, |
84 const content::NotificationDetails& details); | 84 const content::NotificationDetails& details); |
85 | 85 |
86 // Downloads icon via the FaviconTabHelper. | 86 // Downloads icon via the FaviconTabHelper. |
87 void DownloadIcon(); | 87 void DownloadIcon(); |
88 | 88 |
89 // Favicon download callback. | 89 // Favicon download callback. |
90 void DidDownloadFavicon( | 90 void DidDownloadFavicon( |
91 int id, | 91 int id, |
| 92 int http_status_code, |
92 const GURL& image_url, | 93 const GURL& image_url, |
93 int requested_size, | 94 int requested_size, |
94 const std::vector<SkBitmap>& bitmaps); | 95 const std::vector<SkBitmap>& bitmaps); |
95 | 96 |
96 // Checks if shortcuts exists on desktop, start menu and quick launch. | 97 // Checks if shortcuts exists on desktop, start menu and quick launch. |
97 void CheckExistingShortcuts(); | 98 void CheckExistingShortcuts(); |
98 | 99 |
99 // Update shortcut files and icons. | 100 // Update shortcut files and icons. |
100 void UpdateShortcuts(); | 101 void UpdateShortcuts(); |
101 void UpdateShortcutsOnFileThread(); | 102 void UpdateShortcutsOnFileThread(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 true, // favicon | 186 true, // favicon |
186 std::max(unprocessed_icons_.back().width, | 187 std::max(unprocessed_icons_.back().width, |
187 unprocessed_icons_.back().height), | 188 unprocessed_icons_.back().height), |
188 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon, | 189 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon, |
189 base::Unretained(this))); | 190 base::Unretained(this))); |
190 unprocessed_icons_.pop_back(); | 191 unprocessed_icons_.pop_back(); |
191 } | 192 } |
192 | 193 |
193 void UpdateShortcutWorker::DidDownloadFavicon( | 194 void UpdateShortcutWorker::DidDownloadFavicon( |
194 int id, | 195 int id, |
| 196 int http_status_code, |
195 const GURL& image_url, | 197 const GURL& image_url, |
196 int requested_size, | 198 int requested_size, |
197 const std::vector<SkBitmap>& bitmaps) { | 199 const std::vector<SkBitmap>& bitmaps) { |
198 std::vector<ui::ScaleFactor> scale_factors; | 200 std::vector<ui::ScaleFactor> scale_factors; |
199 scale_factors.push_back(ui::SCALE_FACTOR_100P); | 201 scale_factors.push_back(ui::SCALE_FACTOR_100P); |
200 | 202 |
201 size_t closest_index = | 203 size_t closest_index = |
202 FaviconUtil::SelectBestFaviconFromBitmaps(bitmaps, | 204 FaviconUtil::SelectBestFaviconFromBitmaps(bitmaps, |
203 scale_factors, | 205 scale_factors, |
204 requested_size); | 206 requested_size); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 } | 475 } |
474 | 476 |
475 // |info_list| may still be empty at this point, in which case LoadImage | 477 // |info_list| may still be empty at this point, in which case LoadImage |
476 // will call the OnImageLoaded callback with an empty image and exit | 478 // will call the OnImageLoaded callback with an empty image and exit |
477 // immediately. | 479 // immediately. |
478 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, | 480 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, |
479 base::Bind(&OnImageLoaded, shortcut_info, callback)); | 481 base::Bind(&OnImageLoaded, shortcut_info, callback)); |
480 } | 482 } |
481 | 483 |
482 } // namespace web_app | 484 } // namespace web_app |
OLD | NEW |