| 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/views/create_application_shortcut_view.h" | 5 #include "chrome/browser/ui/views/create_application_shortcut_view.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/win/windows_version.h" | 9 #include "base/win/windows_version.h" |
| 10 #include "chrome/browser/extensions/extension_tab_helper.h" | 10 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 11 #include "chrome/browser/favicon_tab_helper.h" | |
| 12 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 13 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 15 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 14 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 16 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 17 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/common/extensions/extension_resource.h" | 17 #include "chrome/common/extensions/extension_resource.h" |
| 19 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 20 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
| 21 #include "content/browser/tab_contents/tab_contents_delegate.h" | 20 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 void CreateUrlApplicationShortcutView::FetchIcon() { | 446 void CreateUrlApplicationShortcutView::FetchIcon() { |
| 448 // There should only be fetch job at a time. | 447 // There should only be fetch job at a time. |
| 449 DCHECK(pending_download_ == NULL); | 448 DCHECK(pending_download_ == NULL); |
| 450 | 449 |
| 451 if (unprocessed_icons_.empty()) // No icons to fetch. | 450 if (unprocessed_icons_.empty()) // No icons to fetch. |
| 452 return; | 451 return; |
| 453 | 452 |
| 454 pending_download_ = new IconDownloadCallbackFunctor(this); | 453 pending_download_ = new IconDownloadCallbackFunctor(this); |
| 455 DCHECK(pending_download_); | 454 DCHECK(pending_download_); |
| 456 | 455 |
| 457 tab_contents_->favicon_tab_helper()->DownloadImage( | 456 tab_contents_->tab_contents()->favicon_helper().DownloadImage( |
| 458 unprocessed_icons_.back().url, | 457 unprocessed_icons_.back().url, |
| 459 std::max(unprocessed_icons_.back().width, | 458 std::max(unprocessed_icons_.back().width, |
| 460 unprocessed_icons_.back().height), | 459 unprocessed_icons_.back().height), |
| 461 NewCallback(pending_download_, &IconDownloadCallbackFunctor::Run)); | 460 NewCallback(pending_download_, &IconDownloadCallbackFunctor::Run)); |
| 462 | 461 |
| 463 unprocessed_icons_.pop_back(); | 462 unprocessed_icons_.pop_back(); |
| 464 } | 463 } |
| 465 | 464 |
| 466 void CreateUrlApplicationShortcutView::OnIconDownloaded(bool errored, | 465 void CreateUrlApplicationShortcutView::OnIconDownloaded(bool errored, |
| 467 const SkBitmap& image) { | 466 const SkBitmap& image) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 void CreateChromeApplicationShortcutView::OnImageLoaded( | 519 void CreateChromeApplicationShortcutView::OnImageLoaded( |
| 521 SkBitmap* image, const ExtensionResource& resource, int index) { | 520 SkBitmap* image, const ExtensionResource& resource, int index) { |
| 522 if (image->isNull()) { | 521 if (image->isNull()) { |
| 523 NOTREACHED() << "Corrupt image in profile?"; | 522 NOTREACHED() << "Corrupt image in profile?"; |
| 524 return; | 523 return; |
| 525 } | 524 } |
| 526 shortcut_info_.favicon = *image; | 525 shortcut_info_.favicon = *image; |
| 527 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); | 526 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
| 528 } | 527 } |
| 529 | 528 |
| OLD | NEW |