| 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/views/create_application_shortcut_view.h" | 5 #include "chrome/browser/ui/views/create_application_shortcut_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 return true; | 483 return true; |
| 484 } | 484 } |
| 485 | 485 |
| 486 void CreateUrlApplicationShortcutView::FetchIcon() { | 486 void CreateUrlApplicationShortcutView::FetchIcon() { |
| 487 // There should only be fetch job at a time. | 487 // There should only be fetch job at a time. |
| 488 DCHECK_EQ(-1, pending_download_id_); | 488 DCHECK_EQ(-1, pending_download_id_); |
| 489 | 489 |
| 490 if (unprocessed_icons_.empty()) // No icons to fetch. | 490 if (unprocessed_icons_.empty()) // No icons to fetch. |
| 491 return; | 491 return; |
| 492 | 492 |
| 493 pending_download_id_ = web_contents_->DownloadFavicon( | 493 pending_download_id_ = web_contents_->DownloadImage( |
| 494 unprocessed_icons_.back().url, | 494 unprocessed_icons_.back().url, |
| 495 std::max(unprocessed_icons_.back().width, | 495 std::max(unprocessed_icons_.back().width, |
| 496 unprocessed_icons_.back().height), | 496 unprocessed_icons_.back().height), |
| 497 base::Bind(&CreateUrlApplicationShortcutView::DidDownloadFavicon, | 497 base::Bind(&CreateUrlApplicationShortcutView::DidDownloadFavicon, |
| 498 base::Unretained(this))); | 498 base::Unretained(this))); |
| 499 | 499 |
| 500 unprocessed_icons_.pop_back(); | 500 unprocessed_icons_.pop_back(); |
| 501 } | 501 } |
| 502 | 502 |
| 503 void CreateUrlApplicationShortcutView::DidDownloadFavicon( | 503 void CreateUrlApplicationShortcutView::DidDownloadFavicon( |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} | 553 CreateChromeApplicationShortcutView::~CreateChromeApplicationShortcutView() {} |
| 554 | 554 |
| 555 // Called when the app's ShortcutInfo (with icon) is loaded. | 555 // Called when the app's ShortcutInfo (with icon) is loaded. |
| 556 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded( | 556 void CreateChromeApplicationShortcutView::OnShortcutInfoLoaded( |
| 557 const ShellIntegration::ShortcutInfo& shortcut_info) { | 557 const ShellIntegration::ShortcutInfo& shortcut_info) { |
| 558 shortcut_info_ = shortcut_info; | 558 shortcut_info_ = shortcut_info; |
| 559 | 559 |
| 560 CHECK(app_info_); | 560 CHECK(app_info_); |
| 561 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); | 561 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); |
| 562 } | 562 } |
| OLD | NEW |