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

Side by Side Diff: chrome/browser/ui/toolbar/recent_tabs_sub_menu_model.cc

Issue 331163003: [Refactor] Change FaviconService API to take in a desired pixel size (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 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 16 matching lines...) Expand all
27 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" 27 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
28 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
29 #include "components/favicon_base/favicon_types.h" 29 #include "components/favicon_base/favicon_types.h"
30 #include "grit/browser_resources.h" 30 #include "grit/browser_resources.h"
31 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
32 #include "grit/theme_resources.h" 32 #include "grit/theme_resources.h"
33 #include "grit/ui_resources.h" 33 #include "grit/ui_resources.h"
34 #include "ui/base/accelerators/accelerator.h" 34 #include "ui/base/accelerators/accelerator.h"
35 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
36 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
37 #include "ui/gfx/favicon_size.h"
38 37
39 #if defined(USE_ASH) 38 #if defined(USE_ASH)
40 #include "ash/accelerators/accelerator_table.h" 39 #include "ash/accelerators/accelerator_table.h"
41 #endif // defined(USE_ASH) 40 #endif // defined(USE_ASH)
42 41
43 namespace { 42 namespace {
44 43
45 // Initial comamnd ID's for navigatable (and hence executable) tab/window menu 44 // Initial comamnd ID's for navigatable (and hence executable) tab/window menu
46 // items. The menumodel and storage structures are not 1-1: 45 // items. The menumodel and storage structures are not 1-1:
47 // - menumodel has "Recently closed" header, "No tabs from other devices", 46 // - menumodel has "Recently closed" header, "No tabs from other devices",
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 // Otherwise, start to fetch the favicon from local history asynchronously. 606 // Otherwise, start to fetch the favicon from local history asynchronously.
608 // Set default icon first. 607 // Set default icon first.
609 SetIcon(index_in_menu, default_favicon_); 608 SetIcon(index_in_menu, default_favicon_);
610 // Start request to fetch actual icon if possible. 609 // Start request to fetch actual icon if possible.
611 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile( 610 FaviconService* favicon_service = FaviconServiceFactory::GetForProfile(
612 browser_->profile(), Profile::EXPLICIT_ACCESS); 611 browser_->profile(), Profile::EXPLICIT_ACCESS);
613 if (!favicon_service) 612 if (!favicon_service)
614 return; 613 return;
615 614
616 favicon_service->GetFaviconImageForPageURL( 615 favicon_service->GetFaviconImageForPageURL(
617 FaviconService::FaviconForPageURLParams( 616 url,
618 url, favicon_base::FAVICON, gfx::kFaviconSize),
619 base::Bind(&RecentTabsSubMenuModel::OnFaviconDataAvailable, 617 base::Bind(&RecentTabsSubMenuModel::OnFaviconDataAvailable,
620 weak_ptr_factory_.GetWeakPtr(), 618 weak_ptr_factory_.GetWeakPtr(),
621 command_id), 619 command_id),
622 is_local_tab ? &local_tab_cancelable_task_tracker_ 620 is_local_tab ? &local_tab_cancelable_task_tracker_
623 : &other_devices_tab_cancelable_task_tracker_); 621 : &other_devices_tab_cancelable_task_tracker_);
624 } 622 }
625 623
626 void RecentTabsSubMenuModel::OnFaviconDataAvailable( 624 void RecentTabsSubMenuModel::OnFaviconDataAvailable(
627 int command_id, 625 int command_id,
628 const favicon_base::FaviconImageResult& image_result) { 626 const favicon_base::FaviconImageResult& image_result) {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 683
686 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); 684 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate();
687 if (menu_model_delegate) 685 if (menu_model_delegate)
688 menu_model_delegate->OnMenuStructureChanged(); 686 menu_model_delegate->OnMenuStructureChanged();
689 } 687 }
690 688
691 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( 689 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed(
692 TabRestoreService* service) { 690 TabRestoreService* service) {
693 TabRestoreServiceChanged(service); 691 TabRestoreServiceChanged(service);
694 } 692 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/back_forward_menu_model.cc ('k') | chrome/browser/ui/webui/extensions/extension_icon_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698