| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/toolbar/recent_tabs_sub_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 // Otherwise, start to fetch the favicon from local history asynchronously. | 602 // Otherwise, start to fetch the favicon from local history asynchronously. |
| 603 // Set default icon first. | 603 // Set default icon first. |
| 604 SetIcon(index_in_menu, default_favicon_); | 604 SetIcon(index_in_menu, default_favicon_); |
| 605 // Start request to fetch actual icon if possible. | 605 // Start request to fetch actual icon if possible. |
| 606 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( | 606 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( |
| 607 browser_->profile(), Profile::EXPLICIT_ACCESS); | 607 browser_->profile(), Profile::EXPLICIT_ACCESS); |
| 608 if (!favicon_service) | 608 if (!favicon_service) |
| 609 return; | 609 return; |
| 610 | 610 |
| 611 favicon_service->GetFaviconImageForURL( | 611 favicon_service->GetFaviconImageForURL( |
| 612 FaviconService::FaviconForURLParams(browser_->profile(), | 612 FaviconService::FaviconForURLParams(url, |
| 613 url, | |
| 614 chrome::FAVICON, | 613 chrome::FAVICON, |
| 615 gfx::kFaviconSize), | 614 gfx::kFaviconSize), |
| 616 base::Bind(&RecentTabsSubMenuModel::OnFaviconDataAvailable, | 615 base::Bind(&RecentTabsSubMenuModel::OnFaviconDataAvailable, |
| 617 weak_ptr_factory_.GetWeakPtr(), | 616 weak_ptr_factory_.GetWeakPtr(), |
| 618 command_id), | 617 command_id), |
| 619 is_local_tab ? &local_tab_cancelable_task_tracker_ : | 618 is_local_tab ? &local_tab_cancelable_task_tracker_ : |
| 620 &other_devices_tab_cancelable_task_tracker_); | 619 &other_devices_tab_cancelable_task_tracker_); |
| 621 } | 620 } |
| 622 | 621 |
| 623 void RecentTabsSubMenuModel::OnFaviconDataAvailable( | 622 void RecentTabsSubMenuModel::OnFaviconDataAvailable( |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 | 680 |
| 682 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); | 681 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); |
| 683 if (menu_model_delegate) | 682 if (menu_model_delegate) |
| 684 menu_model_delegate->OnMenuStructureChanged(); | 683 menu_model_delegate->OnMenuStructureChanged(); |
| 685 } | 684 } |
| 686 | 685 |
| 687 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( | 686 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( |
| 688 TabRestoreService* service) { | 687 TabRestoreService* service) { |
| 689 TabRestoreServiceChanged(service); | 688 TabRestoreServiceChanged(service); |
| 690 } | 689 } |
| OLD | NEW |