| 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 std::max(unprocessed_icons_.back().width, | 175 std::max(unprocessed_icons_.back().width, |
| 176 unprocessed_icons_.back().height), | 176 unprocessed_icons_.back().height), |
| 177 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon, | 177 base::Bind(&UpdateShortcutWorker::DidDownloadFavicon, |
| 178 base::Unretained(this))); | 178 base::Unretained(this))); |
| 179 unprocessed_icons_.pop_back(); | 179 unprocessed_icons_.pop_back(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void UpdateShortcutWorker::DidDownloadFavicon( | 182 void UpdateShortcutWorker::DidDownloadFavicon( |
| 183 int id, | 183 int id, |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 | 437 |
| 438 // |info_list| may still be empty at this point, in which case LoadImage | 438 // |info_list| may still be empty at this point, in which case LoadImage |
| 439 // will call the OnImageLoaded callback with an empty image and exit | 439 // will call the OnImageLoaded callback with an empty image and exit |
| 440 // immediately. | 440 // immediately. |
| 441 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, | 441 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, |
| 442 base::Bind(&OnImageLoaded, shortcut_info, callback)); | 442 base::Bind(&OnImageLoaded, shortcut_info, callback)); |
| 443 } | 443 } |
| 444 | 444 |
| 445 } // namespace web_app | 445 } // namespace web_app |
| OLD | NEW |