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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 auto& tab = | 457 auto& tab = |
458 static_cast<const sessions::TabRestoreService::Tab&>(*entry); | 458 static_cast<const sessions::TabRestoreService::Tab&>(*entry); |
459 const sessions::SerializedNavigationEntry& current_navigation = | 459 const sessions::SerializedNavigationEntry& current_navigation = |
460 tab.navigations.at(tab.current_navigation_index); | 460 tab.navigations.at(tab.current_navigation_index); |
461 BuildLocalTabItem(entry->id, current_navigation.title(), | 461 BuildLocalTabItem(entry->id, current_navigation.title(), |
462 current_navigation.virtual_url(), | 462 current_navigation.virtual_url(), |
463 ++last_local_model_index_); | 463 ++last_local_model_index_); |
464 break; | 464 break; |
465 } | 465 } |
466 case sessions::TabRestoreService::WINDOW: { | 466 case sessions::TabRestoreService::WINDOW: { |
| 467 // TODO(chrisha): Make this menu entry better. When windows contain a |
| 468 // single tab, display that tab directly in the menu. Otherwise, offer |
| 469 // a hover over or alternative mechanism for seeing which tabs were in |
| 470 // the window. |
467 BuildLocalWindowItem( | 471 BuildLocalWindowItem( |
468 entry->id, | 472 entry->id, |
469 static_cast<const sessions::TabRestoreService::Window&>(*entry) | 473 static_cast<const sessions::TabRestoreService::Window&>(*entry) |
470 .tabs.size(), | 474 .tabs.size(), |
471 ++last_local_model_index_); | 475 ++last_local_model_index_); |
472 break; | 476 break; |
473 } | 477 } |
474 } | 478 } |
475 ++added_count; | 479 ++added_count; |
476 } | 480 } |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 void RecentTabsSubMenuModel::OnForeignSessionUpdated( | 765 void RecentTabsSubMenuModel::OnForeignSessionUpdated( |
762 syncer::SyncService* sync) { | 766 syncer::SyncService* sync) { |
763 ClearTabsFromOtherDevices(); | 767 ClearTabsFromOtherDevices(); |
764 | 768 |
765 BuildTabsFromOtherDevices(); | 769 BuildTabsFromOtherDevices(); |
766 | 770 |
767 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); | 771 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); |
768 if (menu_model_delegate) | 772 if (menu_model_delegate) |
769 menu_model_delegate->OnMenuStructureChanged(); | 773 menu_model_delegate->OnMenuStructureChanged(); |
770 } | 774 } |
OLD | NEW |