| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 AddTabFavicon(command_id, item.url); | 520 AddTabFavicon(command_id, item.url); |
| 521 local_tab_navigation_items_.push_back(item); | 521 local_tab_navigation_items_.push_back(item); |
| 522 } | 522 } |
| 523 | 523 |
| 524 void RecentTabsSubMenuModel::BuildLocalWindowItem( | 524 void RecentTabsSubMenuModel::BuildLocalWindowItem( |
| 525 const SessionID::id_type& window_id, | 525 const SessionID::id_type& window_id, |
| 526 int num_tabs, | 526 int num_tabs, |
| 527 int curr_model_index) { | 527 int curr_model_index) { |
| 528 int command_id = WindowVectorIndexToCommandId(local_window_items_.size()); | 528 int command_id = WindowVectorIndexToCommandId(local_window_items_.size()); |
| 529 // See comments in BuildLocalEntries() about usage of InsertItem*At(). | 529 // See comments in BuildLocalEntries() about usage of InsertItem*At(). |
| 530 if (num_tabs == 1) { | 530 InsertItemAt(curr_model_index, command_id, l10n_util::GetPluralStringFUTF16( |
| 531 InsertItemWithStringIdAt(curr_model_index, command_id, | 531 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW, num_tabs)); |
| 532 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE); | |
| 533 } else { | |
| 534 InsertItemAt(curr_model_index, command_id, l10n_util::GetStringFUTF16( | |
| 535 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE, | |
| 536 base::IntToString16(num_tabs))); | |
| 537 } | |
| 538 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 532 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 539 SetIcon(curr_model_index, rb.GetNativeImageNamed(IDR_RECENTLY_CLOSED_WINDOW)); | 533 SetIcon(curr_model_index, rb.GetNativeImageNamed(IDR_RECENTLY_CLOSED_WINDOW)); |
| 540 local_window_items_.push_back(window_id); | 534 local_window_items_.push_back(window_id); |
| 541 } | 535 } |
| 542 | 536 |
| 543 void RecentTabsSubMenuModel::BuildOtherDevicesTabItem( | 537 void RecentTabsSubMenuModel::BuildOtherDevicesTabItem( |
| 544 const std::string& session_tag, | 538 const std::string& session_tag, |
| 545 const sessions::SessionTab& tab) { | 539 const sessions::SessionTab& tab) { |
| 546 const sessions::SerializedNavigationEntry& current_navigation = | 540 const sessions::SerializedNavigationEntry& current_navigation = |
| 547 tab.navigations.at(tab.normalized_navigation_index()); | 541 tab.navigations.at(tab.normalized_navigation_index()); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 | 682 |
| 689 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); | 683 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); |
| 690 if (menu_model_delegate) | 684 if (menu_model_delegate) |
| 691 menu_model_delegate->OnMenuStructureChanged(); | 685 menu_model_delegate->OnMenuStructureChanged(); |
| 692 } | 686 } |
| 693 | 687 |
| 694 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( | 688 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( |
| 695 TabRestoreService* service) { | 689 TabRestoreService* service) { |
| 696 TabRestoreServiceChanged(service); | 690 TabRestoreServiceChanged(service); |
| 697 } | 691 } |
| OLD | NEW |