diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 17:16:02 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 17:16:02 +0000 |
commit | 55af4046de847a9f423336d10ac4230c45ac2603 (patch) | |
tree | c55c8dfe66703fb2a5c0fe7cdb6352afedde84c0 | |
parent | d5c99b1735e08464682837ac5a61d985de2a7b3c (diff) | |
download | chromium_src-55af4046de847a9f423336d10ac4230c45ac2603.zip chromium_src-55af4046de847a9f423336d10ac4230c45ac2603.tar.gz chromium_src-55af4046de847a9f423336d10ac4230c45ac2603.tar.bz2 |
Make non-glass popups match new mockup from Glen.
Unfortunately glass popups can't be made to match the mockup unless we want to completely reimplement Windows titlebar drawing, so I'm leaving them pretty much unchanged :(
BUG=7569
Review URL: http://codereview.chromium.org/28072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10341 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/theme/locationbg_readonly_center.png | bin | 177 -> 169 bytes | |||
-rw-r--r-- | chrome/app/theme/locationbg_readonly_edge.png | bin | 0 -> 180 bytes | |||
-rw-r--r-- | chrome/app/theme/locationbg_readonly_left.png | bin | 126 -> 0 bytes | |||
-rw-r--r-- | chrome/app/theme/locationbg_readonly_right.png | bin | 127 -> 0 bytes | |||
-rw-r--r-- | chrome/app/theme/theme_resources.grd | 3 | ||||
-rw-r--r-- | chrome/browser/views/frame/aero_glass_non_client_view.cc | 18 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/frame/browser_view.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.cc | 72 | ||||
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.h | 10 | ||||
-rw-r--r-- | chrome/browser/views/location_bar_view.cc | 12 | ||||
-rw-r--r-- | chrome/browser/views/location_bar_view.h | 9 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.cc | 61 | ||||
-rw-r--r-- | chrome/browser/views/toolbar_view.h | 12 |
14 files changed, 102 insertions, 102 deletions
diff --git a/chrome/app/theme/locationbg_readonly_center.png b/chrome/app/theme/locationbg_readonly_center.png Binary files differindex d13d279..effd919 100644 --- a/chrome/app/theme/locationbg_readonly_center.png +++ b/chrome/app/theme/locationbg_readonly_center.png diff --git a/chrome/app/theme/locationbg_readonly_edge.png b/chrome/app/theme/locationbg_readonly_edge.png Binary files differnew file mode 100644 index 0000000..ce4a34c --- /dev/null +++ b/chrome/app/theme/locationbg_readonly_edge.png diff --git a/chrome/app/theme/locationbg_readonly_left.png b/chrome/app/theme/locationbg_readonly_left.png Binary files differdeleted file mode 100644 index 07b0fb8..0000000 --- a/chrome/app/theme/locationbg_readonly_left.png +++ /dev/null diff --git a/chrome/app/theme/locationbg_readonly_right.png b/chrome/app/theme/locationbg_readonly_right.png Binary files differdeleted file mode 100644 index fe932dc..0000000 --- a/chrome/app/theme/locationbg_readonly_right.png +++ /dev/null diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd index 12d25d7..a443a57 100644 --- a/chrome/app/theme/theme_resources.grd +++ b/chrome/app/theme/theme_resources.grd @@ -265,9 +265,8 @@ <include name="IDR_UPDATE_AVAILABLE" file="update_available.png" type="BINDATA" /> <include name="IDR_MENU_PAGE" file="menu_page.png" type="BINDATA" /> <include name="IDR_MENU_CHROME" file="menu_chrome.png" type="BINDATA" /> - <include name="IDR_LOCATIONBG_POPUPMODE_LEFT" file="locationbg_readonly_left.png" type="BINDATA" /> <include name="IDR_LOCATIONBG_POPUPMODE_CENTER" file="locationbg_readonly_center.png" type="BINDATA" /> - <include name="IDR_LOCATIONBG_POPUPMODE_RIGHT" file="locationbg_readonly_right.png" type="BINDATA" /> + <include name="IDR_LOCATIONBG_POPUPMODE_EDGE" file="locationbg_readonly_edge.png" type="BINDATA" /> <include name="IDR_CLOSE_SA" file="close_sa.png" type="BINDATA" /> <include name="IDR_CLOSE_SA_H" file="close_sa_h.png" type="BINDATA" /> <include name="IDR_CLOSE_SA_P" file="close_sa_p.png" type="BINDATA" /> diff --git a/chrome/browser/views/frame/aero_glass_non_client_view.cc b/chrome/browser/views/frame/aero_glass_non_client_view.cc index f787885..6c5589e 100644 --- a/chrome/browser/views/frame/aero_glass_non_client_view.cc +++ b/chrome/browser/views/frame/aero_glass_non_client_view.cc @@ -276,21 +276,13 @@ void AeroGlassNonClientView::PaintOTRAvatar(ChromeCanvas* canvas) { } void AeroGlassNonClientView::PaintClientEdge(ChromeCanvas* canvas) { + // The client edges start below the toolbar upper corner images regardless + // of how tall the toolbar itself is. int client_area_top = - frame_->client_view()->y() + browser_view_->GetToolbarBounds().bottom(); - gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); - // The toolbar draws a client edge along its own bottom edge when it's visible - // and in normal mode. However, it only draws this for the width of the - // actual client area, leaving a gap at the left and right edges: - // - // | Toolbar | <-- part of toolbar - // ----- (toolbar client edge) ----- <-- gap - // | Client area | <-- right client edge - // - // To address this, we extend the left and right client edges up to fill the - // gap, by pretending the toolbar is shorter than it really is. - client_area_top -= kClientEdgeThickness; + frame_->client_view()->y() + browser_view_->GetToolbarBounds().y() + + resources_->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT)->height(); + gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); int client_area_bottom = std::max(client_area_top, height() - NonClientBorderThickness()); int client_area_height = client_area_bottom - client_area_top; diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 7836e7f..7de9e9d 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -310,10 +310,6 @@ bool BrowserView::IsTabStripVisible() const { return SupportsWindowFeature(FEATURE_TABSTRIP); } -bool BrowserView::IsToolbarDisplayModeNormal() const { - return toolbar_->IsDisplayModeNormal(); -} - bool BrowserView::IsOffTheRecord() const { return browser_->profile()->IsOffTheRecord(); } diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h index d8726d8..f1d0b0d 100644 --- a/chrome/browser/views/frame/browser_view.h +++ b/chrome/browser/views/frame/browser_view.h @@ -99,9 +99,6 @@ class BrowserView : public BrowserWindow, bool IsToolbarVisible() const; bool IsTabStripVisible() const; - // Returns true if the toolbar is displaying its normal set of controls. - bool IsToolbarDisplayModeNormal() const; - // Returns true if the profile associated with this Browser window is // off the record. bool IsOffTheRecord() const; diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index bb4da43..d1bb800 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -61,10 +61,6 @@ enum { FRAME_NO_TOOLBAR_TOP_CENTER, FRAME_NO_TOOLBAR_TOP_RIGHT, - // Popup-mode toolbar edges. - FRAME_TOOLBAR_POPUP_EDGE_LEFT, - FRAME_TOOLBAR_POPUP_EDGE_RIGHT, - FRAME_PART_BITMAP_COUNT // Must be last. }; @@ -99,7 +95,6 @@ class ActiveWindowResources : public views::WindowResources { IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, IDR_APP_TOP_LEFT, IDR_APP_TOP_CENTER, IDR_APP_TOP_RIGHT, - IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, }; ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -145,7 +140,6 @@ class InactiveWindowResources : public views::WindowResources { IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, IDR_APP_TOP_LEFT, IDR_APP_TOP_CENTER, IDR_APP_TOP_RIGHT, - IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, }; ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -191,7 +185,6 @@ class OTRActiveWindowResources : public views::WindowResources { IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, IDR_APP_TOP_LEFT, IDR_APP_TOP_CENTER, IDR_APP_TOP_RIGHT, - IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, }; ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -238,7 +231,6 @@ class OTRInactiveWindowResources : public views::WindowResources { IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, IDR_APP_TOP_LEFT, IDR_APP_TOP_CENTER, IDR_APP_TOP_RIGHT, - IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, }; ResourceBundle& rb = ResourceBundle::GetSharedInstance(); @@ -695,9 +687,14 @@ int OpaqueNonClientView::NonClientTopBorderHeight() const { 0 : kNonClientRestoredExtraThickness); } -int OpaqueNonClientView::BottomEdgeThicknessWithinNonClientHeight() const { +int OpaqueNonClientView::UnavailablePixelsAtBottomOfNonClientHeight() const { + // Tricky: When a toolbar is edging the titlebar, it not only draws its own + // shadow and client edge, but an extra, light "shadow" pixel as well, which + // is treated as available space. Thus the nonclient area actually _fails_ to + // include some available pixels, leading to a negative number here. if (browser_view_->IsToolbarVisible()) - return 0; + return -kFrameShadowThickness; + return kFrameShadowThickness + (frame_->IsMaximized() ? 0 : kClientEdgeThickness); } @@ -726,7 +723,7 @@ int OpaqueNonClientView::TitleCoordinates(int* title_top_spacing, *title_thickness = std::max(title_font_.height(), min_titlebar_height - *title_top_spacing - title_bottom_spacing); return *title_top_spacing + *title_thickness + title_bottom_spacing + - BottomEdgeThicknessWithinNonClientHeight(); + UnavailablePixelsAtBottomOfNonClientHeight(); } void OpaqueNonClientView::PaintRestoredFrameBorder(ChromeCanvas* canvas) { @@ -822,28 +819,34 @@ void OpaqueNonClientView::PaintTitleBar(ChromeCanvas* canvas) { void OpaqueNonClientView::PaintToolbarBackground(ChromeCanvas* canvas) { if (!browser_view_->IsToolbarVisible()) return; - + gfx::Rect toolbar_bounds(browser_view_->GetToolbarBounds()); gfx::Point toolbar_origin(toolbar_bounds.origin()); View::ConvertPointToView(frame_->client_view(), this, &toolbar_origin); toolbar_bounds.set_origin(toolbar_origin); - bool normal_mode = browser_view_->IsToolbarDisplayModeNormal(); - SkBitmap* toolbar_left = resources()->GetPartBitmap(normal_mode ? - FRAME_CLIENT_EDGE_TOP_LEFT : FRAME_TOOLBAR_POPUP_EDGE_LEFT); + SkBitmap* toolbar_left = + resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT); canvas->DrawBitmapInt(*toolbar_left, toolbar_bounds.x() - toolbar_left->width(), toolbar_bounds.y()); - if (normal_mode) { - SkBitmap* toolbar_center = - resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP); - canvas->TileImageInt(*toolbar_center, toolbar_bounds.x(), - toolbar_bounds.y(), toolbar_bounds.width(), toolbar_center->height()); - } + // Gross hack: We split the toolbar image into two pieces, since sometimes + // (popup mode) the toolbar isn't tall enough to show the whole image. The + // split happens between the top shadow section and the bottom gradient + // section so that we never break the gradient. + int split_point = kFrameShadowThickness * 2; + SkBitmap* toolbar_center = + resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP); + canvas->TileImageInt(*toolbar_center, 0, 0, toolbar_bounds.x(), + toolbar_bounds.y(), toolbar_bounds.width(), split_point); + canvas->TileImageInt(*toolbar_center, 0, + toolbar_center->height() - toolbar_bounds.height() + split_point, + toolbar_bounds.x(), toolbar_bounds.y() + split_point, + toolbar_bounds.width(), toolbar_bounds.height() - split_point); - canvas->DrawBitmapInt(*resources()->GetPartBitmap(normal_mode ? - FRAME_CLIENT_EDGE_TOP_RIGHT : FRAME_TOOLBAR_POPUP_EDGE_RIGHT), + canvas->DrawBitmapInt( + *resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_RIGHT), toolbar_bounds.right(), toolbar_bounds.y()); } @@ -860,23 +863,14 @@ void OpaqueNonClientView::PaintOTRAvatar(ChromeCanvas* canvas) { } void OpaqueNonClientView::PaintRestoredClientEdge(ChromeCanvas* canvas) { - int client_area_top = - frame_->client_view()->y() + browser_view_->GetToolbarBounds().bottom(); + int client_area_top = frame_->client_view()->y(); gfx::Rect client_area_bounds = CalculateClientAreaBounds(width(), height()); - if (browser_view_->IsToolbarVisible() && - browser_view_->IsToolbarDisplayModeNormal()) { - // The toolbar draws a client edge along its own bottom edge when it's - // visible and in normal mode. However, it only draws this for the width of - // the actual client area, leaving a gap at the left and right edges: - // - // | Toolbar | <-- part of toolbar - // ----- (toolbar client edge) ----- <-- gap - // | Client area | <-- right client edge - // - // To address this, we extend the left and right client edges up to fill the - // gap, by pretending the toolbar is shorter than it really is. - client_area_top -= kClientEdgeThickness; + if (browser_view_->IsToolbarVisible()) { + // The client edges start below the toolbar upper corner images regardless + // of how tall the toolbar itself is. + client_area_top += browser_view_->GetToolbarBounds().y() + + resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT)->height(); } else { // The toolbar isn't going to draw a client edge for us, so draw one // ourselves. @@ -996,7 +990,7 @@ void OpaqueNonClientView::LayoutTitleBar() { int title_top_spacing, title_thickness; int top_height = TitleCoordinates(&title_top_spacing, &title_thickness); int available_height = top_height - frame_thickness - - BottomEdgeThicknessWithinNonClientHeight(); + UnavailablePixelsAtBottomOfNonClientHeight(); // The icon takes up a constant fraction of the available height, down to a // minimum size, and is always an even number of pixels on a side (presumably diff --git a/chrome/browser/views/frame/opaque_non_client_view.h b/chrome/browser/views/frame/opaque_non_client_view.h index 58c5fa1..8caf563 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.h +++ b/chrome/browser/views/frame/opaque_non_client_view.h @@ -85,11 +85,11 @@ class OpaqueNonClientView : public views::NonClientView, // frame, any title area, and any connected client edge. int NonClientTopBorderHeight() const; - // For windows without a toolbar, a bottom border, and, in restored mode, a - // client edge are drawn at the bottom of the titlebar. When a toolbar is - // present, neither of these are drawn, as the toolbar itself will edge the - // titlebar area. This returns the height of any such edge. - int BottomEdgeThicknessWithinNonClientHeight() const; + // The nonclient area at the top of the window may include some "unavailable" + // pixels at its bottom: a dark shadow along the bottom of the titlebar and a + // client edge. These vary from mode to mode, so this function returns the + // number of such pixels the nonclient height includes. + int UnavailablePixelsAtBottomOfNonClientHeight() const; // Calculates multiple values related to title layout. Returns the height of // the entire titlebar including any connected client edge. diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 45b19c63..7cd64a7 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -200,8 +200,7 @@ void LocationBarView::SetProfile(Profile* profile) { gfx::Size LocationBarView::GetPreferredSize() { return gfx::Size(0, - (popup_window_mode_ ? kPopupBackground : kBackground)->height() - - TopOffset()); + (popup_window_mode_ ? kPopupBackground : kBackground)->height()); } void LocationBarView::Layout() { @@ -218,8 +217,7 @@ void LocationBarView::Paint(ChromeCanvas* canvas) { const SkBitmap* background = popup_window_mode_ ? kPopupBackground : kBackground; - int top_offset = std::min(TopOffset(), height()); - canvas->TileImageInt(*background, 0, top_offset, 0, 0, width(), height()); + canvas->TileImageInt(*background, 0, 0, 0, 0, width(), height()); int top_margin = TopMargin(); canvas->FillRectInt(bg, 0, top_margin, width(), std::max(height() - top_margin - kVertMargin, 0)); @@ -398,12 +396,8 @@ void LocationBarView::DoLayout(const bool force_layout) { } } -int LocationBarView::TopOffset() const { - return (popup_window_mode_ && win_util::ShouldUseVistaFrame()) ? 1 : 0; -} - int LocationBarView::TopMargin() const { - return std::min(kVertMargin - TopOffset(), height()); + return std::min(kVertMargin, height()); } int LocationBarView::TextDisplayWidth() { diff --git a/chrome/browser/views/location_bar_view.h b/chrome/browser/views/location_bar_view.h index 0764bd9..ef8c73b 100644 --- a/chrome/browser/views/location_bar_view.h +++ b/chrome/browser/views/location_bar_view.h @@ -283,14 +283,7 @@ class LocationBarView : public LocationBar, // to necessitate a layout, layout occurs as well. void DoLayout(bool force_layout); - // Returns the number of pixels to clip off the top edge of the background - // graphics. With the Vista frame, the DWM draws a dark border around the - // content, so we clip the single dark pixel on the popup background image, - // which otherwise looks redundant. - int TopOffset() const; - - // Returns the height in pixels of the margin at the top of the bar, after - // TopOffset() pixels have been clipped off. + // Returns the height in pixels of the margin at the top of the bar. int TopMargin() const; // Returns the width in pixels of the contents of the edit. diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index bc2d778..56195b4 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -61,6 +61,12 @@ static const int kMenuButtonOffset = 3; // Padding to the right of the location bar static const int kPaddingRight = 2; +static const int kPopupTopSpacingNonGlass = 3; +static const int kPopupBottomSpacingNonGlass = 2; +static const int kPopupBottomSpacingGlass = 1; + +static SkBitmap* kPopupBackgroundEdge = NULL; + BrowserToolbarView::BrowserToolbarView(Browser* browser) : EncodingMenuControllerDelegate(browser), model_(browser->toolbar_model()), @@ -90,6 +96,11 @@ BrowserToolbarView::BrowserToolbarView(Browser* browser) display_mode_ = DISPLAYMODE_NORMAL; else display_mode_ = DISPLAYMODE_LOCATION; + + if (!kPopupBackgroundEdge) { + kPopupBackgroundEdge = ResourceBundle::GetSharedInstance().GetBitmapNamed( + IDR_LOCATIONBG_POPUPMODE_EDGE); + } } BrowserToolbarView::~BrowserToolbarView() { @@ -259,8 +270,10 @@ void BrowserToolbarView::Layout() { return; if (!IsDisplayModeNormal()) { - location_bar_->SetBounds(0, 0, width(), - location_bar_->GetPreferredSize().height()); + int edge_width = (browser_->window() && browser_->window()->IsMaximized()) ? + 0 : kPopupBackgroundEdge->width(); // See Paint(). + location_bar_->SetBounds(edge_width, PopupTopSpacing(), + width() - (edge_width * 2), location_bar_->GetPreferredSize().height()); return; } @@ -320,6 +333,28 @@ void BrowserToolbarView::Layout() { app_menu_width, child_height); } +void BrowserToolbarView::Paint(ChromeCanvas* canvas) { + View::Paint(canvas); + + if (IsDisplayModeNormal()) + return; + + // In maximized mode, we don't draw the endcaps on the location bar, because + // when they're flush against the edge of the screen they just look glitchy. + if (!browser_->window() || !browser_->window()->IsMaximized()) { + int top_spacing = PopupTopSpacing(); + canvas->DrawBitmapInt(*kPopupBackgroundEdge, 0, top_spacing); + canvas->DrawBitmapInt(*kPopupBackgroundEdge, + width() - kPopupBackgroundEdge->width(), top_spacing); + } + + // For glass, we need to draw a black line below the location bar to separate + // it from the content area. For non-glass, the NonClientView draws the + // toolbar background below the location bar for us. + if (win_util::ShouldUseVistaFrame()) + canvas->FillRectInt(SK_ColorBLACK, 0, height() - 1, width(), 1); +} + void BrowserToolbarView::DidGainFocus() { // Check to see if MSAA focus should be restored to previously focused button, // and if button is an enabled, visibled child of toolbar. @@ -459,19 +494,10 @@ gfx::Size BrowserToolbarView::GetPreferredSize() { return gfx::Size(0, normal_background.height()); } - // With the non-Vista frame, we'll draw a client edge below the toolbar for - // non-maximized popups. - // Note: We make sure to return the same value in the "no browser window" case - // as the "not maximized" case, so that when a popup is opened at a particular - // requested size, we'll report the same preferred size during the initial - // window size calculation (when there isn't yet a browser window) as when - // we're actually laying things out after setting up the browser window. This - // prevents the content area from being off by |kClientEdgeThickness| px. - int client_edge_height = win_util::ShouldUseVistaFrame() || - (browser_->window() && browser_->window()->IsMaximized()) ? - 0 : views::NonClientView::kClientEdgeThickness; - return gfx::Size(0, - location_bar_->GetPreferredSize().height() + client_edge_height); + int vertical_spacing = PopupTopSpacing() + (win_util::ShouldUseVistaFrame() ? + kPopupBottomSpacingGlass : kPopupBottomSpacingNonGlass); + return gfx::Size(0, location_bar_->GetPreferredSize().height() + + vertical_spacing); } void BrowserToolbarView::RunPageMenu(const CPoint& pt, HWND hwnd) { @@ -772,6 +798,11 @@ void BrowserToolbarView::ButtonPressed(views::BaseButton* sender) { browser_->ExecuteCommand(sender->GetTag()); } +// static +int BrowserToolbarView::PopupTopSpacing() { + return win_util::ShouldUseVistaFrame() ? 0 : kPopupTopSpacingNonGlass; +} + void BrowserToolbarView::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { diff --git a/chrome/browser/views/toolbar_view.h b/chrome/browser/views/toolbar_view.h index ff77107..4e4a560 100644 --- a/chrome/browser/views/toolbar_view.h +++ b/chrome/browser/views/toolbar_view.h @@ -52,6 +52,7 @@ class BrowserToolbarView : public views::View, // views::View virtual void Layout(); + virtual void Paint(ChromeCanvas* canvas); virtual void DidGainFocus(); virtual void WillLoseFocus(); virtual bool OnKeyPressed(const views::KeyEvent& e); @@ -80,10 +81,6 @@ class BrowserToolbarView : public views::View, LocationBarView* GetLocationBarView() const { return location_bar_; } - bool IsDisplayModeNormal() const { - return display_mode_ == DISPLAYMODE_NORMAL; - } - // Updates the toolbar (and transitively the location bar) with the states of // the specified |tab|. If |should_restore_state| is true, we're switching // (back?) to this tab and should restore any previous location bar state @@ -135,6 +132,9 @@ class BrowserToolbarView : public views::View, DISPLAYMODE_LOCATION }; + // Returns the number of pixels above the location bar in non-normal display. + static int PopupTopSpacing(); + // NotificationObserver virtual void Observe(NotificationType type, const NotificationSource& source, @@ -168,6 +168,10 @@ class BrowserToolbarView : public views::View, // accessibility focus. virtual void ShowContextMenu(int x, int y, bool is_mouse_gesture); + bool IsDisplayModeNormal() const { + return display_mode_ == DISPLAYMODE_NORMAL; + } + scoped_ptr<BackForwardMenuModelWin> back_menu_model_; scoped_ptr<BackForwardMenuModelWin> forward_menu_model_; |