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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 DeleteMe(); // We are done if underlying WebContents is gone. | 163 DeleteMe(); // We are done if underlying WebContents is gone. |
164 return; | 164 return; |
165 } | 165 } |
166 | 166 |
167 if (unprocessed_icons_.empty()) { | 167 if (unprocessed_icons_.empty()) { |
168 // No app icon. Just use the favicon from WebContents. | 168 // No app icon. Just use the favicon from WebContents. |
169 UpdateShortcuts(); | 169 UpdateShortcuts(); |
170 return; | 170 return; |
171 } | 171 } |
172 | 172 |
173 web_contents_->DownloadFavicon( | 173 web_contents_->DownloadImage( |
174 unprocessed_icons_.back().url, | 174 unprocessed_icons_.back().url, |
175 true, // favicon | 175 true, // favicon |
176 std::max(unprocessed_icons_.back().width, | 176 std::max(unprocessed_icons_.back().width, |
177 unprocessed_icons_.back().height), | 177 unprocessed_icons_.back().height), |
178 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon, | 178 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon, |
179 base::Unretained(this))); | 179 base::Unretained(this))); |
180 unprocessed_icons_.pop_back(); | 180 unprocessed_icons_.pop_back(); |
181 } | 181 } |
182 | 182 |
183 void UpdateShortcutWorker::DidDownloadFavicon( | 183 void UpdateShortcutWorker::DidDownloadFavicon( |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 } | 439 } |
440 | 440 |
441 // |info_list| may still be empty at this point, in which case LoadImage | 441 // |info_list| may still be empty at this point, in which case LoadImage |
442 // will call the OnImageLoaded callback with an empty image and exit | 442 // will call the OnImageLoaded callback with an empty image and exit |
443 // immediately. | 443 // immediately. |
444 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, | 444 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, |
445 base::Bind(&OnImageLoaded, shortcut_info, callback)); | 445 base::Bind(&OnImageLoaded, shortcut_info, callback)); |
446 } | 446 } |
447 | 447 |
448 } // namespace web_app | 448 } // namespace web_app |
OLD | NEW |