| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 if (unprocessed_icons_.empty()) { | 130 if (unprocessed_icons_.empty()) { |
| 131 // No app icon. Just use the favicon from TabContents. | 131 // No app icon. Just use the favicon from TabContents. |
| 132 UpdateShortcuts(); | 132 UpdateShortcuts(); |
| 133 return; | 133 return; |
| 134 } | 134 } |
| 135 | 135 |
| 136 tab_contents_->tab_contents()->favicon_helper().DownloadImage( | 136 tab_contents_->tab_contents()->favicon_helper().DownloadImage( |
| 137 unprocessed_icons_.back().url, | 137 unprocessed_icons_.back().url, |
| 138 std::max(unprocessed_icons_.back().width, | 138 std::max(unprocessed_icons_.back().width, |
| 139 unprocessed_icons_.back().height), | 139 unprocessed_icons_.back().height), |
| 140 history::FAVICON, |
| 140 NewCallback(this, &UpdateShortcutWorker::OnIconDownloaded)); | 141 NewCallback(this, &UpdateShortcutWorker::OnIconDownloaded)); |
| 141 unprocessed_icons_.pop_back(); | 142 unprocessed_icons_.pop_back(); |
| 142 } | 143 } |
| 143 | 144 |
| 144 void UpdateShortcutWorker::OnIconDownloaded(int download_id, | 145 void UpdateShortcutWorker::OnIconDownloaded(int download_id, |
| 145 bool errored, | 146 bool errored, |
| 146 const SkBitmap& image) { | 147 const SkBitmap& image) { |
| 147 if (tab_contents_ == NULL) { | 148 if (tab_contents_ == NULL) { |
| 148 DeleteMe(); // We are done if underlying TabContents is gone. | 149 DeleteMe(); // We are done if underlying TabContents is gone. |
| 149 return; | 150 return; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 309 |
| 309 void UpdateShortcutForTabContents(TabContentsWrapper* tab_contents) { | 310 void UpdateShortcutForTabContents(TabContentsWrapper* tab_contents) { |
| 310 #if defined(OS_WIN) | 311 #if defined(OS_WIN) |
| 311 // UpdateShortcutWorker will delete itself when it's done. | 312 // UpdateShortcutWorker will delete itself when it's done. |
| 312 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); | 313 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); |
| 313 worker->Run(); | 314 worker->Run(); |
| 314 #endif // defined(OS_WIN) | 315 #endif // defined(OS_WIN) |
| 315 } | 316 } |
| 316 | 317 |
| 317 } // namespace web_app | 318 } // namespace web_app |
| OLD | NEW |