diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-19 22:22:56 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-19 22:22:56 +0000 |
commit | 27239fb2b868ef6aff2d9d13932ba5debe87e9c7 (patch) | |
tree | 709dc5559aa96f57875ee48f449f86b5a0ae36eb /chrome/browser/tabs | |
parent | a5d16da421fc2eaa785204a9cf99e0c82ff159c4 (diff) | |
download | chromium_src-27239fb2b868ef6aff2d9d13932ba5debe87e9c7.zip chromium_src-27239fb2b868ef6aff2d9d13932ba5debe87e9c7.tar.gz chromium_src-27239fb2b868ef6aff2d9d13932ba5debe87e9c7.tar.bz2 |
Allow dynamic switching in and out of sidetabs mode.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1001003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42156 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tabs')
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.cc | 24 | ||||
-rw-r--r-- | chrome/browser/tabs/tab_strip_model.h | 11 |
2 files changed, 33 insertions, 2 deletions
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index 2fba4b5..dc9b968 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -574,11 +574,25 @@ bool TabStripModel::IsContextMenuCommandEnabled( return delegate_->CanRestoreTab(); case CommandTogglePinned: return true; - case CommandBookmarkAllTabs: { + case CommandBookmarkAllTabs: return delegate_->CanBookmarkAllTabs(); - } + case CommandUseVerticalTabs: + return true; + default: + NOTREACHED(); + } + return false; +} + +bool TabStripModel::IsContextMenuCommandChecked( + int context_index, + ContextMenuCommand command_id) const { + switch (command_id) { + case CommandUseVerticalTabs: + return delegate()->UseVerticalTabs(); default: NOTREACHED(); + break; } return false; } @@ -656,6 +670,12 @@ void TabStripModel::ExecuteContextMenuCommand( delegate_->BookmarkAllTabs(); break; } + case CommandUseVerticalTabs: { + UserMetrics::RecordAction("TabContextMenu_UseVerticalTabs", profile_); + + delegate()->ToggleUseVerticalTabs(); + break; + } default: NOTREACHED(); } diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h index a4c3641..1f5214f 100644 --- a/chrome/browser/tabs/tab_strip_model.h +++ b/chrome/browser/tabs/tab_strip_model.h @@ -223,6 +223,12 @@ class TabStripModelDelegate { // Creates a bookmark folder containing a bookmark for all open tabs. virtual void BookmarkAllTabs() = 0; + + // Returns true if the vertical tabstrip presentation should be used. + virtual bool UseVerticalTabs() const = 0; + + // Toggles the use of the vertical tabstrip. + virtual void ToggleUseVerticalTabs() = 0; }; //////////////////////////////////////////////////////////////////////////////// @@ -547,6 +553,7 @@ class TabStripModel : public NotificationObserver { CommandRestoreTab, CommandTogglePinned, CommandBookmarkAllTabs, + CommandUseVerticalTabs, CommandLast }; @@ -554,6 +561,10 @@ class TabStripModel : public NotificationObserver { bool IsContextMenuCommandEnabled(int context_index, ContextMenuCommand command_id) const; + // Returns true if the specified command is checked. + bool IsContextMenuCommandChecked(int context_index, + ContextMenuCommand command_id) const; + // Performs the action associated with the specified command for the given // TabStripModel index |context_index|. void ExecuteContextMenuCommand(int context_index, |