Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: chrome/browser/ui/views/create_application_shortcut_view.cc

Issue 11011002: Switch FaviconTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 void CreateUrlApplicationShortcutView::FetchIcon() { 456 void CreateUrlApplicationShortcutView::FetchIcon() {
457 // There should only be fetch job at a time. 457 // There should only be fetch job at a time.
458 DCHECK(pending_download_ == NULL); 458 DCHECK(pending_download_ == NULL);
459 459
460 if (unprocessed_icons_.empty()) // No icons to fetch. 460 if (unprocessed_icons_.empty()) // No icons to fetch.
461 return; 461 return;
462 462
463 pending_download_ = new IconDownloadCallbackFunctor(this); 463 pending_download_ = new IconDownloadCallbackFunctor(this);
464 DCHECK(pending_download_); 464 DCHECK(pending_download_);
465 465
466 tab_contents_->favicon_tab_helper()->DownloadImage( 466 FaviconTabHelper::FromWebContents(tab_contents_->web_contents())->
467 unprocessed_icons_.back().url, 467 DownloadImage(unprocessed_icons_.back().url,
468 std::max(unprocessed_icons_.back().width, 468 std::max(unprocessed_icons_.back().width,
469 unprocessed_icons_.back().height), 469 unprocessed_icons_.back().height),
470 history::FAVICON, 470 history::FAVICON,
471 base::Bind(&IconDownloadCallbackFunctor::Run, 471 base::Bind(&IconDownloadCallbackFunctor::Run,
472 base::Unretained(pending_download_))); 472 base::Unretained(pending_download_)));
473 473
474 unprocessed_icons_.pop_back(); 474 unprocessed_icons_.pop_back();
475 } 475 }
476 476
477 void CreateUrlApplicationShortcutView::OnIconDownloaded(bool errored, 477 void CreateUrlApplicationShortcutView::OnIconDownloaded(bool errored,
478 const SkBitmap& image) { 478 const SkBitmap& image) {
479 pending_download_ = NULL; 479 pending_download_ = NULL;
480 480
481 if (!errored && !image.isNull()) { 481 if (!errored && !image.isNull()) {
482 shortcut_info_.favicon = gfx::Image(image); 482 shortcut_info_.favicon = gfx::Image(image);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 if (image.IsEmpty()) { 540 if (image.IsEmpty()) {
541 shortcut_info_.favicon = ui::ResourceBundle::GetSharedInstance(). 541 shortcut_info_.favicon = ui::ResourceBundle::GetSharedInstance().
542 GetImageNamed(IDR_APP_DEFAULT_ICON); 542 GetImageNamed(IDR_APP_DEFAULT_ICON);
543 } else { 543 } else {
544 shortcut_info_.favicon = image; 544 shortcut_info_.favicon = image;
545 } 545 }
546 546
547 CHECK(app_info_); 547 CHECK(app_info_);
548 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon); 548 static_cast<AppInfoView*>(app_info_)->UpdateIcon(shortcut_info_.favicon);
549 } 549 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/tab_contents/tab_contents.cc ('k') | chrome/browser/ui/views/extensions/shell_window_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698