diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 16:47:08 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-02 16:47:08 +0000 |
commit | 12f9faa592c28028cb833347a641ab0b9bab4b40 (patch) | |
tree | d96db1e66eef1b1577e3426a15f5ad9cf38f2525 /chrome/browser/chromeos/compact_navigation_bar.cc | |
parent | 82e2f2bab320ec135fc00417984a4fa6a93014a1 (diff) | |
download | chromium_src-12f9faa592c28028cb833347a641ab0b9bab4b40.zip chromium_src-12f9faa592c28028cb833347a641ab0b9bab4b40.tar.gz chromium_src-12f9faa592c28028cb833347a641ab0b9bab4b40.tar.bz2 |
Some enhancements as requested to the compact nav bar. The search box looks
larger, back and foward moved to the right, there is a border below the tab
strip.
Importantly, the compact nav bar can be switched on and off at runtime via the
app menu (which creates a new window with it) rather than using the command
line flag.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/171112
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25179 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/compact_navigation_bar.cc')
-rw-r--r-- | chrome/browser/chromeos/compact_navigation_bar.cc | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/chrome/browser/chromeos/compact_navigation_bar.cc b/chrome/browser/chromeos/compact_navigation_bar.cc index e2be4a0..a4b1d97 100644 --- a/chrome/browser/chromeos/compact_navigation_bar.cc +++ b/chrome/browser/chromeos/compact_navigation_bar.cc @@ -25,10 +25,14 @@ static const int kInnerPadding = 1; // Spacing between buttons. static const int kHorizPadding = 3; -static const int kURLWidth = 150; +static const int kURLWidth = 180; static const int kChromeButtonSize = 25; +// Draw this much white around the URL bar to make it look larger than it +// actually is. +static const int kURLPadding = 2; + CompactNavigationBar::CompactNavigationBar(Browser* browser) : browser_(browser), initialized_(false) { @@ -87,13 +91,14 @@ gfx::Size CompactNavigationBar::GetPreferredSize() { int width = 0; width += kChromeButtonSize + kHorizPadding; // Chrome button. - width += kURLWidth + kHorizPadding; // URL bar. + width += kURLWidth + kHorizPadding + kURLPadding * 2; // URL bar. width += back_button_->GetPreferredSize().width() + kHorizPadding + kInnerPadding * 2; width += bf_separator_->GetPreferredSize().width() + kHorizPadding; width += forward_button_->GetPreferredSize().width() + kHorizPadding + kInnerPadding * 2; + width++; return gfx::Size(width, kChromeButtonSize); } @@ -106,10 +111,6 @@ void CompactNavigationBar::Layout() { chrome_button_->SetBounds(curx, 0, kChromeButtonSize, height()); curx += kChromeButtonSize + kHorizPadding; - // URL bar. - location_entry_view_->SetBounds(curx, 0, kURLWidth, height()); - curx += kURLWidth + kHorizPadding; - // "Back | Forward" section. gfx::Size button_size = back_button_->GetPreferredSize(); button_size.set_width(button_size.width() + kInnerPadding * 2); @@ -124,6 +125,11 @@ void CompactNavigationBar::Layout() { button_size.set_width(button_size.width() + kInnerPadding * 2); forward_button_->SetBounds(curx, 0, button_size.width(), height()); curx += button_size.width() + kHorizPadding; + + // URL bar. + location_entry_view_->SetBounds(curx + kURLPadding, 0, + kURLWidth + kURLPadding * 2, height()); + curx += kURLWidth + kHorizPadding + kURLPadding * 2; } void CompactNavigationBar::Paint(gfx::Canvas* canvas) { @@ -136,6 +142,15 @@ void CompactNavigationBar::Paint(gfx::Canvas* canvas) { else background = theme->GetBitmapNamed(IDR_THEME_FRAME_INACTIVE); canvas->TileImageInt(*background, 0, 0, width(), height()); + + // Draw a white box around the edit field so that it looks larger. This is + // kind of what the default GTK location bar does, although they have a + // fancier border. + canvas->FillRectInt(0xFFFFFFFF, + location_entry_view_->x() - kURLPadding, + 2, + location_entry_view_->width() + kURLPadding * 2, + height() - 5); } void CompactNavigationBar::ButtonPressed(views::Button* sender) { |