| 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/cocoa/history_menu_bridge.h" | 5 #include "chrome/browser/ui/cocoa/history_menu_bridge.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/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 // Tab navigations don't come with icons, so we always have to request them. | 452 // Tab navigations don't come with icons, so we always have to request them. |
| 453 GetFaviconForHistoryItem(item); | 453 GetFaviconForHistoryItem(item); |
| 454 | 454 |
| 455 return item; | 455 return item; |
| 456 } | 456 } |
| 457 | 457 |
| 458 void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) { | 458 void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) { |
| 459 FaviconService* service = | 459 FaviconService* service = |
| 460 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 460 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 461 CancelableTaskTracker::TaskId task_id = service->GetFaviconImageForURL( | 461 CancelableTaskTracker::TaskId task_id = service->GetFaviconImageForURL( |
| 462 FaviconService::FaviconForURLParams(profile_, | 462 FaviconService::FaviconForURLParams(item->url, |
| 463 item->url, | |
| 464 chrome::FAVICON, | 463 chrome::FAVICON, |
| 465 gfx::kFaviconSize), | 464 gfx::kFaviconSize), |
| 466 base::Bind(&HistoryMenuBridge::GotFaviconData, | 465 base::Bind(&HistoryMenuBridge::GotFaviconData, |
| 467 base::Unretained(this), | 466 base::Unretained(this), |
| 468 item), | 467 item), |
| 469 &cancelable_task_tracker_); | 468 &cancelable_task_tracker_); |
| 470 item->icon_task_id = task_id; | 469 item->icon_task_id = task_id; |
| 471 item->icon_requested = true; | 470 item->icon_requested = true; |
| 472 } | 471 } |
| 473 | 472 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 489 } | 488 } |
| 490 | 489 |
| 491 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { | 490 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { |
| 492 DCHECK(item); | 491 DCHECK(item); |
| 493 if (item->icon_requested) { | 492 if (item->icon_requested) { |
| 494 cancelable_task_tracker_.TryCancel(item->icon_task_id); | 493 cancelable_task_tracker_.TryCancel(item->icon_task_id); |
| 495 item->icon_requested = false; | 494 item->icon_requested = false; |
| 496 item->icon_task_id = CancelableTaskTracker::kBadTaskId; | 495 item->icon_task_id = CancelableTaskTracker::kBadTaskId; |
| 497 } | 496 } |
| 498 } | 497 } |
| OLD | NEW |