| 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/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 // Tab navigations don't come with icons, so we always have to request them. | 449 // Tab navigations don't come with icons, so we always have to request them. |
| 450 GetFaviconForHistoryItem(item); | 450 GetFaviconForHistoryItem(item); |
| 451 | 451 |
| 452 return item; | 452 return item; |
| 453 } | 453 } |
| 454 | 454 |
| 455 void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) { | 455 void HistoryMenuBridge::GetFaviconForHistoryItem(HistoryItem* item) { |
| 456 FaviconService* service = | 456 FaviconService* service = |
| 457 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 457 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 458 FaviconService::Handle handle = service->GetFaviconImageForURL( | 458 FaviconService::Handle handle = service->GetFaviconImageForURL( |
| 459 profile_, item->url, history::FAVICON, gfx::kFaviconSize, | 459 FaviconService::FaviconForURLParams(profile_, item->url, history::FAVICON, |
| 460 &favicon_consumer_, | 460 gfx::kFaviconSize, &favicon_consumer_), |
| 461 base::Bind(&HistoryMenuBridge::GotFaviconData, base::Unretained(this))); | 461 base::Bind(&HistoryMenuBridge::GotFaviconData, base::Unretained(this))); |
| 462 favicon_consumer_.SetClientData(service, handle, item); | 462 favicon_consumer_.SetClientData(service, handle, item); |
| 463 item->icon_handle = handle; | 463 item->icon_handle = handle; |
| 464 item->icon_requested = true; | 464 item->icon_requested = true; |
| 465 } | 465 } |
| 466 | 466 |
| 467 void HistoryMenuBridge::GotFaviconData( | 467 void HistoryMenuBridge::GotFaviconData( |
| 468 FaviconService::Handle handle, | 468 FaviconService::Handle handle, |
| 469 const history::FaviconImageResult& image_result) { | 469 const history::FaviconImageResult& image_result) { |
| 470 // Since we're going to do Cocoa-y things, make sure this is the main thread. | 470 // Since we're going to do Cocoa-y things, make sure this is the main thread. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 488 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { | 488 void HistoryMenuBridge::CancelFaviconRequest(HistoryItem* item) { |
| 489 DCHECK(item); | 489 DCHECK(item); |
| 490 if (item->icon_requested) { | 490 if (item->icon_requested) { |
| 491 FaviconService* service = FaviconServiceFactory::GetForProfile( | 491 FaviconService* service = FaviconServiceFactory::GetForProfile( |
| 492 profile_, Profile::EXPLICIT_ACCESS); | 492 profile_, Profile::EXPLICIT_ACCESS); |
| 493 service->CancelRequest(item->icon_handle); | 493 service->CancelRequest(item->icon_handle); |
| 494 item->icon_requested = false; | 494 item->icon_requested = false; |
| 495 item->icon_handle = 0; | 495 item->icon_handle = 0; |
| 496 } | 496 } |
| 497 } | 497 } |
| OLD | NEW |