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

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

Issue 1130753007: Start axing NTP4 dead code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: estade@ review Created 5 years, 7 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
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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 DCHECK_EQ(last_local_model_index_, -1); 389 DCHECK_EQ(last_local_model_index_, -1);
390 390
391 TabRestoreService* service = 391 TabRestoreService* service =
392 TabRestoreServiceFactory::GetForProfile(browser_->profile()); 392 TabRestoreServiceFactory::GetForProfile(browser_->profile());
393 if (!service || service->entries().size() == 0) { 393 if (!service || service->entries().size() == 0) {
394 // This is to show a disabled restore tab entry with the accelerator to 394 // This is to show a disabled restore tab entry with the accelerator to
395 // teach users about this command. 395 // teach users about this command.
396 InsertItemWithStringIdAt(++last_local_model_index_, 396 InsertItemWithStringIdAt(++last_local_model_index_,
397 kDisabledRecentlyClosedHeaderCommandId, 397 kDisabledRecentlyClosedHeaderCommandId,
398 IDS_NEW_TAB_RECENTLY_CLOSED); 398 IDS_RECENTLY_CLOSED);
399 } else { 399 } else {
400 InsertItemWithStringIdAt(++last_local_model_index_, 400 InsertItemWithStringIdAt(++last_local_model_index_,
401 kRecentlyClosedHeaderCommandId, 401 kRecentlyClosedHeaderCommandId,
402 IDS_NEW_TAB_RECENTLY_CLOSED); 402 IDS_RECENTLY_CLOSED);
403 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 403 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
404 SetIcon(last_local_model_index_, 404 SetIcon(last_local_model_index_,
405 rb.GetNativeImageNamed(IDR_RECENTLY_CLOSED_WINDOW)); 405 rb.GetNativeImageNamed(IDR_RECENTLY_CLOSED_WINDOW));
406 406
407 int added_count = 0; 407 int added_count = 0;
408 TabRestoreService::Entries entries = service->entries(); 408 TabRestoreService::Entries entries = service->entries();
409 for (TabRestoreService::Entries::const_iterator it = entries.begin(); 409 for (TabRestoreService::Entries::const_iterator it = entries.begin();
410 it != entries.end() && added_count < kMaxLocalEntries; ++it) { 410 it != entries.end() && added_count < kMaxLocalEntries; ++it) {
411 TabRestoreService::Entry* entry = *it; 411 TabRestoreService::Entry* entry = *it;
412 if (entry->type == TabRestoreService::TAB) { 412 if (entry->type == TabRestoreService::TAB) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 InsertItemAt(curr_model_index, command_id, l10n_util::GetPluralStringFUTF16( 537 InsertItemAt(curr_model_index, command_id, l10n_util::GetPluralStringFUTF16(
538 IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW, num_tabs)); 538 IDS_RECENTLY_CLOSED_WINDOW, num_tabs));
539 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 539 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
540 SetIcon(curr_model_index, rb.GetNativeImageNamed(IDR_RECENTLY_CLOSED_WINDOW)); 540 SetIcon(curr_model_index, rb.GetNativeImageNamed(IDR_RECENTLY_CLOSED_WINDOW));
541 local_window_items_.push_back(window_id); 541 local_window_items_.push_back(window_id);
542 } 542 }
543 543
544 void RecentTabsSubMenuModel::BuildOtherDevicesTabItem( 544 void RecentTabsSubMenuModel::BuildOtherDevicesTabItem(
545 const std::string& session_tag, 545 const std::string& session_tag,
546 const sessions::SessionTab& tab) { 546 const sessions::SessionTab& tab) {
547 const sessions::SerializedNavigationEntry& current_navigation = 547 const sessions::SerializedNavigationEntry& current_navigation =
548 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
689 689
690 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); 690 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate();
691 if (menu_model_delegate) 691 if (menu_model_delegate)
692 menu_model_delegate->OnMenuStructureChanged(); 692 menu_model_delegate->OnMenuStructureChanged();
693 } 693 }
694 694
695 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( 695 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed(
696 TabRestoreService* service) { 696 TabRestoreService* service) {
697 TabRestoreServiceChanged(service); 697 TabRestoreServiceChanged(service);
698 } 698 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/history_menu_bridge.mm ('k') | chrome/browser/ui/views/frame/global_menu_bar_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698