diff options
-rw-r--r-- | chrome/app/theme/locationbg_readonly_left.png | bin | 147 -> 126 bytes | |||
-rw-r--r-- | chrome/app/theme/locationbg_readonly_right.png | bin | 151 -> 127 bytes | |||
-rw-r--r-- | chrome/browser/views/frame/opaque_non_client_view.cc | 32 | ||||
-rw-r--r-- | chrome/browser/views/location_bar_view.cc | 54 |
4 files changed, 34 insertions, 52 deletions
diff --git a/chrome/app/theme/locationbg_readonly_left.png b/chrome/app/theme/locationbg_readonly_left.png Binary files differindex f9f8ad1..07b0fb8 100644 --- a/chrome/app/theme/locationbg_readonly_left.png +++ b/chrome/app/theme/locationbg_readonly_left.png diff --git a/chrome/app/theme/locationbg_readonly_right.png b/chrome/app/theme/locationbg_readonly_right.png Binary files differindex 44f7666..fe932dc 100644 --- a/chrome/app/theme/locationbg_readonly_right.png +++ b/chrome/app/theme/locationbg_readonly_right.png diff --git a/chrome/browser/views/frame/opaque_non_client_view.cc b/chrome/browser/views/frame/opaque_non_client_view.cc index a59cd10..7272303 100644 --- a/chrome/browser/views/frame/opaque_non_client_view.cc +++ b/chrome/browser/views/frame/opaque_non_client_view.cc @@ -63,6 +63,10 @@ enum { FRAME_CLIENT_EDGE_BOTTOM_LEFT, FRAME_CLIENT_EDGE_LEFT, + // Popup-mode toolbar edges. + FRAME_TOOLBAR_POPUP_EDGE_LEFT, + FRAME_TOOLBAR_POPUP_EDGE_RIGHT, + FRAME_PART_BITMAP_COUNT // Must be last. }; @@ -98,6 +102,7 @@ class ActiveWindowResources : public views::WindowResources { IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, + IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, 0 }; @@ -149,6 +154,7 @@ class InactiveWindowResources : public views::WindowResources { IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, + IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, 0 }; @@ -200,6 +206,7 @@ class OTRActiveWindowResources : public views::WindowResources { IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, + IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, 0 }; @@ -251,6 +258,7 @@ class OTRInactiveWindowResources : public views::WindowResources { IDR_CONTENT_TOP_RIGHT_CORNER, IDR_CONTENT_RIGHT_SIDE, IDR_CONTENT_BOTTOM_RIGHT_CORNER, IDR_CONTENT_BOTTOM_CENTER, IDR_CONTENT_BOTTOM_LEFT_CORNER, IDR_CONTENT_LEFT_SIDE, + IDR_LOCATIONBG_POPUPMODE_LEFT, IDR_LOCATIONBG_POPUPMODE_RIGHT, 0 }; @@ -861,28 +869,30 @@ void OpaqueNonClientView::PaintTitleBar(ChromeCanvas* canvas) { } void OpaqueNonClientView::PaintToolbarBackground(ChromeCanvas* canvas) { - if (!browser_view_->IsToolbarVisible() || - !browser_view_->IsToolbarDisplayModeNormal()) + 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); - SkBitmap* toolbar_left = - resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_LEFT); + bool normal_mode = browser_view_->IsToolbarDisplayModeNormal(); + SkBitmap* toolbar_left = resources()->GetPartBitmap(normal_mode ? + FRAME_CLIENT_EDGE_TOP_LEFT : FRAME_TOOLBAR_POPUP_EDGE_LEFT); canvas->DrawBitmapInt(*toolbar_left, toolbar_bounds.x() - toolbar_left->width(), toolbar_bounds.y()); - 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()); + 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()); + } - canvas->DrawBitmapInt( - *resources()->GetPartBitmap(FRAME_CLIENT_EDGE_TOP_RIGHT), + canvas->DrawBitmapInt(*resources()->GetPartBitmap(normal_mode ? + FRAME_CLIENT_EDGE_TOP_RIGHT : FRAME_TOOLBAR_POPUP_EDGE_RIGHT), toolbar_bounds.right(), toolbar_bounds.y()); } diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index 0ee51ea..ae32080 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -53,11 +53,8 @@ static const int kInnerPadding = 3; static const SkBitmap* kBackground = NULL; -static const SkBitmap* kPopupBackgroundLeft = NULL; -static const SkBitmap* kPopupBackgroundCenter = NULL; -static const SkBitmap* kPopupBackgroundRight = NULL; +static const SkBitmap* kPopupBackground = NULL; static const int kPopupBackgroundVertMargin = 2; -static const int kPopupBackgroundHorzMargin = 2; // The delay the mouse has to be hovering over the lock/warning icon before the // info bubble is shown. @@ -101,12 +98,7 @@ LocationBarView::LocationBarView(Profile* profile, if (!kBackground) { ResourceBundle &rb = ResourceBundle::GetSharedInstance(); kBackground = rb.GetBitmapNamed(IDR_LOCATIONBG); - kPopupBackgroundLeft = - rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_LEFT); - kPopupBackgroundCenter = - rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_CENTER); - kPopupBackgroundRight = - rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_RIGHT); + kPopupBackground = rb.GetBitmapNamed(IDR_LOCATIONBG_POPUPMODE_CENTER); } } @@ -205,12 +197,9 @@ void LocationBarView::SetProfile(Profile* profile) { } gfx::Size LocationBarView::GetPreferredSize() { - return gfx::Size( - 0, - std::max( - (popup_window_mode_ ? kPopupBackgroundCenter - : kBackground)->height(), - security_image_view_.GetPreferredSize().width())); + return gfx::Size(0, + std::max((popup_window_mode_ ? kPopupBackground : kBackground)->height(), + security_image_view_.GetPreferredSize().height())); } void LocationBarView::Layout() { @@ -225,35 +214,18 @@ void LocationBarView::Paint(ChromeCanvas* canvas) { GetGValue(kBackgroundColorByLevel[model_->GetSchemeSecurityLevel()]), GetBValue(kBackgroundColorByLevel[model_->GetSchemeSecurityLevel()])); - if (popup_window_mode_ == false) { + if (popup_window_mode_) { + canvas->TileImageInt(*kPopupBackground, 0, 0, width(), + kPopupBackground->height()); + canvas->FillRectInt(bg, 0, kPopupBackgroundVertMargin, width(), + kPopupBackground->height() - (kPopupBackgroundVertMargin * 2)); + } else { int bh = kBackground->height(); - canvas->TileImageInt(*kBackground, 0, (height() - bh) / 2, width(), bh); - canvas->FillRectInt(bg, kBackgroundHoriMargin, kBackgroundVertMargin, width() - 2 * kBackgroundHoriMargin, bh - kBackgroundVertMargin * 2); - } else { - canvas->TileImageInt(*kPopupBackgroundLeft, 0, 0, - kPopupBackgroundLeft->width(), - kPopupBackgroundLeft->height()); - canvas->TileImageInt(*kPopupBackgroundCenter, - kPopupBackgroundLeft->width(), 0, - width() - - kPopupBackgroundLeft->width() - - kPopupBackgroundRight->width(), - kPopupBackgroundCenter->height()); - canvas->TileImageInt(*kPopupBackgroundRight, - width() - kPopupBackgroundRight->width(), - 0, kPopupBackgroundRight->width(), - kPopupBackgroundRight->height()); - - canvas->FillRectInt(bg, kPopupBackgroundHorzMargin, - kPopupBackgroundVertMargin, - width() - kPopupBackgroundHorzMargin * 2, - kPopupBackgroundCenter->height() - - kPopupBackgroundVertMargin * 2); } } @@ -392,8 +364,8 @@ void LocationBarView::DoLayout(const bool force_layout) { return; // TODO(sky): baseline layout. - const SkBitmap* background = popup_window_mode_ ? kPopupBackgroundCenter - : kBackground; + const SkBitmap* background = + popup_window_mode_ ? kPopupBackground : kBackground; int bh = background->height(); int location_y = ((height() - bh) / 2) + kTextVertMargin; int location_height = bh - (2 * kTextVertMargin); |