diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-29 03:20:27 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-29 03:20:27 +0000 |
commit | ad3d7273dff93e5107a947c05c6a47c35ea7eea7 (patch) | |
tree | dd34fa6e3aaa7080885f5d28e046c76751f7d25f /chrome/browser/views/tabs/side_tab.cc | |
parent | 21bd81995a2dbeb92833ee6b55612ec30ce6122f (diff) | |
download | chromium_src-ad3d7273dff93e5107a947c05c6a47c35ea7eea7.zip chromium_src-ad3d7273dff93e5107a947c05c6a47c35ea7eea7.tar.gz chromium_src-ad3d7273dff93e5107a947c05c6a47c35ea7eea7.tar.bz2 |
Relands your patch to have an option for enabling vertical tabs. I've
added the following additions:
. made the layout work for opaque_browser_frame.
. Only show the menu if the user supplied --enable-vertical-tabs.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1708014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45906 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tabs/side_tab.cc')
-rw-r--r-- | chrome/browser/views/tabs/side_tab.cc | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/chrome/browser/views/tabs/side_tab.cc b/chrome/browser/views/tabs/side_tab.cc index 9c45dd2..dfa18e1 100644 --- a/chrome/browser/views/tabs/side_tab.cc +++ b/chrome/browser/views/tabs/side_tab.cc @@ -57,6 +57,8 @@ SideTab::SideTab(SideTabModel* model) hover_animation_.reset(new SlideAnimation(this)); hover_animation_->SetSlideDuration(kHoverDurationMs); + + SetContextMenuController(this); } SideTab::~SideTab() { @@ -111,6 +113,15 @@ void SideTab::ButtonPressed(views::Button* sender, const views::Event& event) { } //////////////////////////////////////////////////////////////////////////////// +// SideTab, views::ContextMenuController implementation: + +void SideTab::ShowContextMenu(views::View* source, + const gfx::Point& p, + bool is_mouse_gesture) { + model_->ShowContextMenu(this, p); +} + +//////////////////////////////////////////////////////////////////////////////// // SideTab, views::View overrides: void SideTab::Layout() { @@ -120,14 +131,19 @@ void SideTab::Layout() { gfx::Size ps = close_button_->GetPreferredSize(); int close_y = (height() - ps.height()) / 2; - close_button_->SetBounds(width() - ps.width() - close_y, close_y, ps.width(), - ps.height()); + close_button_->SetBounds( + std::max(0, width() - ps.width() - close_y), + close_y, + ps.width(), + ps.height()); int title_y = (height() - font_->height()) / 2; int title_x = icon_bounds_.right() + kIconTitleSpacing; - title_bounds_.SetRect(title_x, title_y, - close_button_->x() - kTitleCloseSpacing - title_x, - font_->height()); + title_bounds_.SetRect( + title_x, + title_y, + std::max(0, close_button_->x() - kTitleCloseSpacing - title_x), + font_->height()); } void SideTab::Paint(gfx::Canvas* canvas) { |