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.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 if (command_id == kRecentlyClosedHeaderCommandId || | 245 if (command_id == kRecentlyClosedHeaderCommandId || |
246 command_id == kDisabledRecentlyClosedHeaderCommandId || | 246 command_id == kDisabledRecentlyClosedHeaderCommandId || |
247 command_id == IDC_RECENT_TABS_NO_DEVICE_TABS || | 247 command_id == IDC_RECENT_TABS_NO_DEVICE_TABS || |
248 IsDeviceNameCommandId(command_id)) { | 248 IsDeviceNameCommandId(command_id)) { |
249 return false; | 249 return false; |
250 } | 250 } |
251 return true; | 251 return true; |
252 } | 252 } |
253 | 253 |
254 bool RecentTabsSubMenuModel::GetAcceleratorForCommandId( | 254 bool RecentTabsSubMenuModel::GetAcceleratorForCommandId( |
255 int command_id, ui::Accelerator* accelerator) { | 255 int command_id, |
| 256 ui::Accelerator* accelerator) const { |
256 // If there are no recently closed items, we show the accelerator beside | 257 // If there are no recently closed items, we show the accelerator beside |
257 // the header, otherwise, we show it beside the first item underneath it. | 258 // the header, otherwise, we show it beside the first item underneath it. |
258 int index_in_menu = GetIndexOfCommandId(command_id); | 259 int index_in_menu = GetIndexOfCommandId(command_id); |
259 int header_index = GetIndexOfCommandId(kRecentlyClosedHeaderCommandId); | 260 int header_index = GetIndexOfCommandId(kRecentlyClosedHeaderCommandId); |
260 if ((command_id == kDisabledRecentlyClosedHeaderCommandId || | 261 if ((command_id == kDisabledRecentlyClosedHeaderCommandId || |
261 (header_index != -1 && index_in_menu == header_index + 1)) && | 262 (header_index != -1 && index_in_menu == header_index + 1)) && |
262 reopen_closed_tab_accelerator_.key_code() != ui::VKEY_UNKNOWN) { | 263 reopen_closed_tab_accelerator_.key_code() != ui::VKEY_UNKNOWN) { |
263 *accelerator = reopen_closed_tab_accelerator_; | 264 *accelerator = reopen_closed_tab_accelerator_; |
264 return true; | 265 return true; |
265 } | 266 } |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 | 724 |
724 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); | 725 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); |
725 if (menu_model_delegate) | 726 if (menu_model_delegate) |
726 menu_model_delegate->OnMenuStructureChanged(); | 727 menu_model_delegate->OnMenuStructureChanged(); |
727 } | 728 } |
728 | 729 |
729 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( | 730 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( |
730 sessions::TabRestoreService* service) { | 731 sessions::TabRestoreService* service) { |
731 TabRestoreServiceChanged(service); | 732 TabRestoreServiceChanged(service); |
732 } | 733 } |
OLD | NEW |