| 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/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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 void UpdateShortcutWorker::OnIconDownloaded(int download_id, | 155 void UpdateShortcutWorker::OnIconDownloaded(int download_id, |
| 156 bool errored, | 156 bool errored, |
| 157 const SkBitmap& image) { | 157 const SkBitmap& image) { |
| 158 if (tab_contents_ == NULL) { | 158 if (tab_contents_ == NULL) { |
| 159 DeleteMe(); // We are done if underlying TabContents is gone. | 159 DeleteMe(); // We are done if underlying TabContents is gone. |
| 160 return; | 160 return; |
| 161 } | 161 } |
| 162 | 162 |
| 163 if (!errored && !image.isNull()) { | 163 if (!errored && !image.isNull()) { |
| 164 // Update icon with download image and update shortcut. | 164 // Update icon with download image and update shortcut. |
| 165 shortcut_info_.favicon = image; | 165 shortcut_info_.favicon = gfx::Image(image); |
| 166 tab_contents_->extension_tab_helper()->SetAppIcon(image); | 166 tab_contents_->extension_tab_helper()->SetAppIcon(image); |
| 167 UpdateShortcuts(); | 167 UpdateShortcuts(); |
| 168 } else { | 168 } else { |
| 169 // Try the next icon otherwise. | 169 // Try the next icon otherwise. |
| 170 DownloadIcon(); | 170 DownloadIcon(); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 void UpdateShortcutWorker::CheckExistingShortcuts() { | 174 void UpdateShortcutWorker::CheckExistingShortcuts() { |
| 175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 175 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 | 315 |
| 316 void UpdateShortcutForTabContents(TabContentsWrapper* tab_contents) { | 316 void UpdateShortcutForTabContents(TabContentsWrapper* tab_contents) { |
| 317 #if defined(OS_WIN) | 317 #if defined(OS_WIN) |
| 318 // UpdateShortcutWorker will delete itself when it's done. | 318 // UpdateShortcutWorker will delete itself when it's done. |
| 319 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); | 319 UpdateShortcutWorker* worker = new UpdateShortcutWorker(tab_contents); |
| 320 worker->Run(); | 320 worker->Run(); |
| 321 #endif // defined(OS_WIN) | 321 #endif // defined(OS_WIN) |
| 322 } | 322 } |
| 323 | 323 |
| 324 } // namespace web_app | 324 } // namespace web_app |
| OLD | NEW |