diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-15 21:14:00 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-15 21:14:00 +0000 |
commit | d902da8c4e7a797e42999f996e01498332a7855b (patch) | |
tree | fc99f30c1039a39c6ae3a9a66e6ccae63d66f738 /chrome | |
parent | 7b73d994dc6edf83fecc7ceec07746a160fbdb07 (diff) | |
download | chromium_src-d902da8c4e7a797e42999f996e01498332a7855b.zip chromium_src-d902da8c4e7a797e42999f996e01498332a7855b.tar.gz chromium_src-d902da8c4e7a797e42999f996e01498332a7855b.tar.bz2 |
Second attempt at extending the back button to the left edge when maximized.
This time, we do everything programatically and extend the target area only when the window is maximized. After this patch, we don't actually get the left-most pixel to be targetable on XP because our frame code is borked, but this should work once we unbork that.
BUG=3484
R=beng
Review URL: http://codereview.chromium.org/13782
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7005 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index 6032d3b..ee8fae8 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -116,6 +116,8 @@ void BrowserToolbarView::CreateLeftSideControls() { ResourceBundle &rb = ResourceBundle::GetSharedInstance(); back_ = new views::ButtonDropDown(back_menu_model_.get()); + back_->SetImageAlignment(views::Button::ALIGN_RIGHT, + views::Button::ALIGN_TOP); back_->SetImage(views::Button::BS_NORMAL, rb.GetBitmapNamed(IDR_BACK)); back_->SetImage(views::Button::BS_HOT, rb.GetBitmapNamed(IDR_BACK_H)); back_->SetImage(views::Button::BS_PUSHED, rb.GetBitmapNamed(IDR_BACK_P)); @@ -261,8 +263,20 @@ void BrowserToolbarView::Layout() { int right_side_width = 0; if (IsDisplayModeNormal()) { sz = back_->GetPreferredSize(); - back_->SetBounds(kControlIndent, kControlVertOffset, sz.width(), - sz.height()); + // TODO(abarth): If the window becomes maximized but is not resized, + // then Layout() might not be called and the back button + // will be slightly the wrong size. We should force a + // Layout() in this case. + // http://crbug.com/5540 + if (browser_->window() && browser_->window()->IsMaximized()) { + // If the window is maximized, we extend the back button to the left so + // that clicking on the left-most pixel will activate the back button. + back_->SetBounds(0, kControlVertOffset, sz.width() + kControlIndent, + sz.height()); + } else { + back_->SetBounds(kControlIndent, kControlVertOffset, sz.width(), + sz.height()); + } sz = forward_->GetPreferredSize(); forward_->SetBounds(back_->x() + back_->width(), kControlVertOffset, |