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

Unified Diff: chrome/browser/views/tabs/side_tab.cc

Issue 1001003: Allow dynamic switching in and out of sidetabs mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/views/tabs/side_tab.cc
===================================================================
--- chrome/browser/views/tabs/side_tab.cc (revision 41630)
+++ chrome/browser/views/tabs/side_tab.cc (working copy)
@@ -56,6 +56,8 @@
hover_animation_.reset(new SlideAnimation(this));
hover_animation_->SetSlideDuration(kHoverDurationMs);
+
+ SetContextMenuController(this);
}
SideTab::~SideTab() {
@@ -110,6 +112,15 @@
}
////////////////////////////////////////////////////////////////////////////////
+// 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() {
@@ -119,14 +130,19 @@
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) {

Powered by Google App Engine
This is Rietveld 408576698