| 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 chrome::ExecuteCommandWithDisposition(browser_, IDC_SHOW_HISTORY, | 285 chrome::ExecuteCommandWithDisposition(browser_, IDC_SHOW_HISTORY, |
| 286 ui::DispositionFromEventFlags(event_flags)); | 286 ui::DispositionFromEventFlags(event_flags)); |
| 287 return; | 287 return; |
| 288 } | 288 } |
| 289 | 289 |
| 290 DCHECK_NE(IDC_RECENT_TABS_NO_DEVICE_TABS, command_id); | 290 DCHECK_NE(IDC_RECENT_TABS_NO_DEVICE_TABS, command_id); |
| 291 DCHECK(!IsDeviceNameCommandId(command_id)); | 291 DCHECK(!IsDeviceNameCommandId(command_id)); |
| 292 | 292 |
| 293 WindowOpenDisposition disposition = | 293 WindowOpenDisposition disposition = |
| 294 ui::DispositionFromEventFlags(event_flags); | 294 ui::DispositionFromEventFlags(event_flags); |
| 295 if (disposition == CURRENT_TAB) // Force to open a new foreground tab. | 295 if (disposition == WindowOpenDisposition::CURRENT_TAB) { |
| 296 disposition = NEW_FOREGROUND_TAB; | 296 // Force to open a new foreground tab. |
| 297 disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; |
| 298 } |
| 297 | 299 |
| 298 sessions::TabRestoreService* service = | 300 sessions::TabRestoreService* service = |
| 299 TabRestoreServiceFactory::GetForProfile(browser_->profile()); | 301 TabRestoreServiceFactory::GetForProfile(browser_->profile()); |
| 300 sessions::LiveTabContext* context = | 302 sessions::LiveTabContext* context = |
| 301 BrowserLiveTabContext::FindContextForWebContents( | 303 BrowserLiveTabContext::FindContextForWebContents( |
| 302 browser_->tab_strip_model()->GetActiveWebContents()); | 304 browser_->tab_strip_model()->GetActiveWebContents()); |
| 303 if (IsTabModelCommandId(command_id)) { | 305 if (IsTabModelCommandId(command_id)) { |
| 304 TabNavigationItems* tab_items = NULL; | 306 TabNavigationItems* tab_items = NULL; |
| 305 int tab_items_idx = CommandIdToTabVectorIndex(command_id, &tab_items); | 307 int tab_items_idx = CommandIdToTabVectorIndex(command_id, &tab_items); |
| 306 const TabNavigationItem& item = (*tab_items)[tab_items_idx]; | 308 const TabNavigationItem& item = (*tab_items)[tab_items_idx]; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 | 727 |
| 726 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); | 728 ui::MenuModelDelegate* menu_model_delegate = GetMenuModelDelegate(); |
| 727 if (menu_model_delegate) | 729 if (menu_model_delegate) |
| 728 menu_model_delegate->OnMenuStructureChanged(); | 730 menu_model_delegate->OnMenuStructureChanged(); |
| 729 } | 731 } |
| 730 | 732 |
| 731 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( | 733 void RecentTabsSubMenuModel::TabRestoreServiceDestroyed( |
| 732 sessions::TabRestoreService* service) { | 734 sessions::TabRestoreService* service) { |
| 733 TabRestoreServiceChanged(service); | 735 TabRestoreServiceChanged(service); |
| 734 } | 736 } |
| OLD | NEW |