diff options
author | sidchat@chromium.org <sidchat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 23:41:59 +0000 |
---|---|---|
committer | sidchat@chromium.org <sidchat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-09 23:41:59 +0000 |
commit | 4ed536fb5831c7ff6c5d2cacaf5182bf9f00af70 (patch) | |
tree | 41799d050159d20283345dc396247e4ee0aae27f /chrome/browser/views/toolbar_view.cc | |
parent | 3ed662c37a3d881feb5b6578eb2e0e44586b3f1a (diff) | |
download | chromium_src-4ed536fb5831c7ff6c5d2cacaf5182bf9f00af70.zip chromium_src-4ed536fb5831c7ff6c5d2cacaf5182bf9f00af70.tar.gz chromium_src-4ed536fb5831c7ff6c5d2cacaf5182bf9f00af70.tar.bz2 |
Browser actions: limit minimum size of omnibox. When decreasing the width of the omnibox, the Browser actions start falling off one by one till there are two left. After that, the omnibox itself starts shrinking, as it normally does. Note that if there is only one browser action, then it remains sticky to the toolbar.
BUG=23962
TEST=none
Review URL: http://codereview.chromium.org/262008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28628 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/toolbar_view.cc')
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index ef460c4..d21db27 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -61,6 +61,9 @@ static const int kStatusBubbleWidth = 480; // Separation between the location bar and the menus. static const int kMenuButtonOffset = 3; +// The minimum width of the location bar when browser actions are visible. +static const int kMinLocationBarWidthWithBrowserActions = 400; + // Padding to the right of the location bar static const int kPaddingRight = 2; @@ -525,6 +528,21 @@ void ToolbarView::Layout() { int available_width = width() - kPaddingRight - bookmark_menu_width - app_menu_width - page_menu_width - browser_actions_width - kMenuButtonOffset - go_button_width - location_x; + + // We wait until the width of location bar is a minimum allowed. After this + // state, the width available for the browser actions is compromised until + // it can hold a minimum number of browser actions (currently 2). After this + // state, the location bar width starts shrinking again, with the minimum + // number of browser actions sticking on the the right of the location bar. + // TODO(sidchat): Use percentage width instead of fixed width to determine + // minimum width of the location bar. BUG=24316. + if (available_width < kMinLocationBarWidthWithBrowserActions && + browser_actions_width > 0) { + available_width += browser_actions_width; + browser_actions_width = browser_actions_->GetClippedPreferredWidth( + available_width - kMinLocationBarWidthWithBrowserActions); + available_width -= browser_actions_width; + } location_bar_->SetBounds(location_x, child_y, std::max(available_width, 0), child_height); |