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