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

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

Issue 10117016: Implementation for switching between recently used tabs using ctrl tilde or quoteleft. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Added tab mru list manager class. Created 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after
1878 content::RecordAction(UserMetricsAction("SelectNumberedTab")); 1878 content::RecordAction(UserMetricsAction("SelectNumberedTab"));
1879 ActivateTabAt(index, true); 1879 ActivateTabAt(index, true);
1880 } 1880 }
1881 } 1881 }
1882 1882
1883 void Browser::SelectLastTab() { 1883 void Browser::SelectLastTab() {
1884 content::RecordAction(UserMetricsAction("SelectLastTab")); 1884 content::RecordAction(UserMetricsAction("SelectLastTab"));
1885 tab_handler_->GetTabStripModel()->SelectLastTab(); 1885 tab_handler_->GetTabStripModel()->SelectLastTab();
1886 } 1886 }
1887 1887
1888 void Browser::SelectNextMRUTab() {
1889 content::RecordAction(UserMetricsAction("SelectNextMRUTab"));
1890 tab_handler_->GetTabStripModel()->SelectNextMRUTab();
1891 }
1892
1888 void Browser::DuplicateTab() { 1893 void Browser::DuplicateTab() {
1889 content::RecordAction(UserMetricsAction("Duplicate")); 1894 content::RecordAction(UserMetricsAction("Duplicate"));
1890 DuplicateContentsAt(active_index()); 1895 DuplicateContentsAt(active_index());
1891 } 1896 }
1892 1897
1893 void Browser::RestoreTab() { 1898 void Browser::RestoreTab() {
1894 content::RecordAction(UserMetricsAction("RestoreTab")); 1899 content::RecordAction(UserMetricsAction("RestoreTab"));
1895 TabRestoreService* service = 1900 TabRestoreService* service =
1896 TabRestoreServiceFactory::GetForProfile(profile_); 1901 TabRestoreServiceFactory::GetForProfile(profile_);
1897 if (!service) 1902 if (!service)
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
3242 case IDC_INTERNET_OPTIONS: OpenInternetOptionsDialog(); break; 3247 case IDC_INTERNET_OPTIONS: OpenInternetOptionsDialog(); break;
3243 case IDC_LANGUAGE_OPTIONS: OpenLanguageOptionsDialog(); break; 3248 case IDC_LANGUAGE_OPTIONS: OpenLanguageOptionsDialog(); break;
3244 #endif 3249 #endif
3245 #if defined(OS_CHROMEOS) && defined(USE_AURA) 3250 #if defined(OS_CHROMEOS) && defined(USE_AURA)
3246 case IDC_NEW_CROSH_TAB: OpenCrosh(); break; 3251 case IDC_NEW_CROSH_TAB: OpenCrosh(); break;
3247 #endif 3252 #endif
3248 case IDC_SHOW_SYNC_SETUP: ShowSyncSetup(SyncPromoUI::SOURCE_MENU); 3253 case IDC_SHOW_SYNC_SETUP: ShowSyncSetup(SyncPromoUI::SOURCE_MENU);
3249 break; 3254 break;
3250 case IDC_TOGGLE_SPEECH_INPUT: ToggleSpeechInput(); break; 3255 case IDC_TOGGLE_SPEECH_INPUT: ToggleSpeechInput(); break;
3251 3256
3257 case IDC_SELECT_NEXT_MRU_TAB: SelectNextMRUTab(); break;
3258
3252 default: 3259 default:
3253 LOG(WARNING) << "Received Unimplemented Command: " << id; 3260 LOG(WARNING) << "Received Unimplemented Command: " << id;
3254 break; 3261 break;
3255 } 3262 }
3256 } 3263 }
3257 3264
3258 /////////////////////////////////////////////////////////////////////////////// 3265 ///////////////////////////////////////////////////////////////////////////////
3259 // Browser, TabHandlerDelegate implementation: 3266 // Browser, TabHandlerDelegate implementation:
3260 3267
3261 Profile* Browser::GetProfile() const { 3268 Profile* Browser::GetProfile() const {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
3468 3475
3469 bool Browser::LargeIconsPermitted() const { 3476 bool Browser::LargeIconsPermitted() const {
3470 // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because 3477 // We don't show the big icons in tabs for TYPE_EXTENSION_APP windows because
3471 // for those windows, we already have a big icon in the top-left outside any 3478 // for those windows, we already have a big icon in the top-left outside any
3472 // tab. Having big tab icons too looks kinda redonk. 3479 // tab. Having big tab icons too looks kinda redonk.
3473 return true; 3480 return true;
3474 } 3481 }
3475 3482
3476 /////////////////////////////////////////////////////////////////////////////// 3483 ///////////////////////////////////////////////////////////////////////////////
3477 // Browser, TabStripModelObserver implementation: 3484 // Browser, TabStripModelObserver implementation:
3478
3479 void Browser::TabInsertedAt(TabContentsWrapper* contents, 3485 void Browser::TabInsertedAt(TabContentsWrapper* contents,
3480 int index, 3486 int index,
3481 bool foreground) { 3487 bool foreground) {
3482 SetAsDelegate(contents, this); 3488 SetAsDelegate(contents, this);
3483 contents->restore_tab_helper()->SetWindowID(session_id()); 3489 contents->restore_tab_helper()->SetWindowID(session_id());
3484 3490
3485 SyncHistoryWithTabs(index); 3491 SyncHistoryWithTabs(index);
3486 3492
3487 // Make sure the loading state is updated correctly, otherwise the throbber 3493 // Make sure the loading state is updated correctly, otherwise the throbber
3488 // won't start if the page is loading. 3494 // won't start if the page is loading.
(...skipping 1284 matching lines...) Expand 10 before | Expand all | Expand 10 after
4773 // Navigation commands 4779 // Navigation commands
4774 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window); 4780 command_updater_.UpdateCommandEnabled(IDC_HOME, normal_window);
4775 4781
4776 // Window management commands 4782 // Window management commands
4777 // TODO(rohitrao): Disable fullscreen on non-Lion? 4783 // TODO(rohitrao): Disable fullscreen on non-Lion?
4778 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, 4784 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN,
4779 !(is_type_panel() && is_app())); 4785 !(is_type_panel() && is_app()));
4780 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, normal_window); 4786 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, normal_window);
4781 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, 4787 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB,
4782 normal_window); 4788 normal_window);
4789 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_MRU_TAB,
4790 normal_window);
4783 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_NEXT, normal_window); 4791 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_NEXT, normal_window);
4784 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_PREVIOUS, normal_window); 4792 command_updater_.UpdateCommandEnabled(IDC_MOVE_TAB_PREVIOUS, normal_window);
4785 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_0, normal_window); 4793 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_0, normal_window);
4786 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_1, normal_window); 4794 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_1, normal_window);
4787 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_2, normal_window); 4795 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_2, normal_window);
4788 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_3, normal_window); 4796 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_3, normal_window);
4789 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window); 4797 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window);
4790 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window); 4798 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window);
4791 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window); 4799 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window);
4792 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window); 4800 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window);
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
5686 ShowSingletonTabOverwritingNTP(params); 5694 ShowSingletonTabOverwritingNTP(params);
5687 } else { 5695 } else {
5688 LoginUIServiceFactory::GetForProfile( 5696 LoginUIServiceFactory::GetForProfile(
5689 profile()->GetOriginalProfile())->ShowLoginUI(false); 5697 profile()->GetOriginalProfile())->ShowLoginUI(false);
5690 } 5698 }
5691 } 5699 }
5692 5700
5693 void Browser::ToggleSpeechInput() { 5701 void Browser::ToggleSpeechInput() {
5694 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); 5702 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput();
5695 } 5703 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698