diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-14 18:22:52 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-14 18:22:52 +0000 |
commit | 9ac7fcb5fdf8aa1c31e0c7665e567e59255235e8 (patch) | |
tree | a4ee969197fc84a3b92bd79dc41fd2df2d140f45 /chrome/browser/tabs | |
parent | 288bfcd3e84eb6747f697578e13b1ad4c81fd727 (diff) | |
download | chromium_src-9ac7fcb5fdf8aa1c31e0c7665e567e59255235e8.zip chromium_src-9ac7fcb5fdf8aa1c31e0c7665e567e59255235e8.tar.gz chromium_src-9ac7fcb5fdf8aa1c31e0c7665e567e59255235e8.tar.bz2 |
Add keyboard shortcuts to reorder tabs left or right on Linux.
It's standard in GTK+ for tabbed interfaces to be reorderable
using ctrl+shift+pgup and ctrl+shift+pgdn (e.g., in Terminal).
The plumbing is included on all platforms, but the shortcut is
only hooked up on Linux.
BUG=21594
Review URL: http://codereview.chromium.org/194088
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs')
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.cc | 10 | ||||
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.h | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index a10c9fe..baca9b0 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -433,6 +433,16 @@ void TabStripModel::SelectLastTab() { SelectTabContentsAt(count() - 1, true); } +void TabStripModel::MoveTabNext() { + int new_index = std::min(selected_index_ + 1, count() - 1); + MoveTabContentsAt(selected_index_, new_index, true); +} + +void TabStripModel::MoveTabPrevious() { + int new_index = std::max(selected_index_ - 1, 0); + MoveTabContentsAt(selected_index_, new_index, true); +} + Browser* TabStripModel::TearOffTabContents(TabContents* detached_contents, const gfx::Rect& window_bounds, const DockInfo& dock_info) { diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h index 4f1d44b..b75a9f86 100644 --- a/chrome/browser/tabs/tab_strip_model.h +++ b/chrome/browser/tabs/tab_strip_model.h @@ -438,6 +438,10 @@ class TabStripModel : public NotificationObserver { // Selects the last tab in the tab strip. void SelectLastTab(); + // Swap adjacent tabs. + void MoveTabNext(); + void MoveTabPrevious(); + // View API ////////////////////////////////////////////////////////////////// // The specified contents should be opened in a new tabstrip. Returns the |