diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-15 20:42:54 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-15 20:42:54 +0000 |
commit | f409f566b898a7b10e1baceecbcaa26cfd0b17f3 (patch) | |
tree | 475c09c88b6159ccd447204ae54b565b07f25113 /chrome/browser/views/toolbar_view.cc | |
parent | 72a9cd3f9e52ff4ff16df9bb018a23c08e455af7 (diff) | |
download | chromium_src-f409f566b898a7b10e1baceecbcaa26cfd0b17f3.zip chromium_src-f409f566b898a7b10e1baceecbcaa26cfd0b17f3.tar.gz chromium_src-f409f566b898a7b10e1baceecbcaa26cfd0b17f3.tar.bz2 |
Make the omnibox popup look nicer. Add dropshadow images (not final). Experiment with some effects.
Adds a positioner interface that allows the popup to size itself to the width of the edit view + the width of the star and go buttons. (Basically the toolbar needs to help the popup position itself).
No results yet!
Review URL: http://codereview.chromium.org/68011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13784 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/toolbar_view.cc')
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index b97fbf8..d5136b6 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -69,6 +69,14 @@ static const int kPopupTopSpacingNonGlass = 3; static const int kPopupBottomSpacingNonGlass = 2; static const int kPopupBottomSpacingGlass = 1; +// The vertical distance between the bottom of the omnibox and the top of the +// popup. +static const int kOmniboxPopupVerticalSpacing = 2; +// The number of pixels of margin on the buttons on either side of the omnibox. +// We use this value to inset the bounds returned for the omnibox popup, since +// we want the popup to be only as wide as the visible frame of the omnibox. +static const int kOmniboxButtonsHorizontalMargin = 2; + static SkBitmap* kPopupBackgroundEdge = NULL; BrowserToolbarView::BrowserToolbarView(Browser* browser) @@ -220,7 +228,8 @@ void BrowserToolbarView::CreateCenterStack(Profile *profile) { location_bar_ = new LocationBarView(profile, browser_->command_updater(), model_, this, - display_mode_ == DISPLAYMODE_LOCATION); + display_mode_ == DISPLAYMODE_LOCATION, + this); AddChildView(location_bar_); location_bar_->Init(); @@ -846,6 +855,22 @@ void BrowserToolbarView::ButtonPressed(views::Button* sender) { event_utils::DispositionFromEventFlags(sender->mouse_event_flags())); } +gfx::Rect BrowserToolbarView::GetPopupBounds() const { + gfx::Point origin; + views::View::ConvertPointToScreen(star_, &origin); + origin.set_y(origin.y() + star_->height() + kOmniboxPopupVerticalSpacing); + gfx::Rect popup_bounds(origin.x(), origin.y(), + star_->width() + location_bar_->width() + go_->width(), + 0); + popup_bounds.set_x(popup_bounds.x()); + popup_bounds.set_y(popup_bounds.y()); + popup_bounds.set_width(popup_bounds.width()); + // Inset the bounds a little, since the buttons on either edge of the omnibox + // have invisible padding that makes the popup appear too wide. + popup_bounds.Inset(kOmniboxButtonsHorizontalMargin, 0); + return popup_bounds; +} + // static int BrowserToolbarView::PopupTopSpacing() { return GetWidget()->AsWindow()->GetNonClientView()->UseNativeFrame() ? |