Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Unified Diff: chrome/browser/views/bookmark_bar_view.cc

Issue 115910: Allow themes to change the background of the new tab page.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/bookmark_bar_view.h ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/bookmark_bar_view.cc
===================================================================
--- chrome/browser/views/bookmark_bar_view.cc (revision 17403)
+++ chrome/browser/views/bookmark_bar_view.cc (working copy)
@@ -68,7 +68,7 @@
static const int kBarHeight = 29;
// Preferred height of the bookmarks bar when only shown on the new tab page.
-static const int kNewtabBarHeight = 57;
+const int BookmarkBarView::kNewtabBarHeight = 57;
// How inset the bookmarks bar is when displayed on the new tab page. This is
// in addition to the margins above.
@@ -90,11 +90,6 @@
// Border colors for the BookmarBarView.
static const SkColor kTopBorderColor = SkColorSetRGB(222, 234, 248);
-// Background color for when the bookmarks bar is only being displayed on the
-// new tab page - this color should match the background color of the new tab
-// page (white, most likely).
-static const SkColor kNewtabBackgroundColor = SkColorSetRGB(255, 255, 255);
-
// Border color for the 'new tab' style bookmarks bar.
static const SkColor kNewtabBorderColor = SkColorSetRGB(195, 206, 224);
@@ -564,8 +559,29 @@
void BookmarkBarView::Paint(gfx::Canvas* canvas) {
if (IsDetachedStyle()) {
// Draw the background to match the new tab page.
- canvas->FillRectInt(kNewtabBackgroundColor, 0, 0, width(), height());
+ ThemeProvider* tp = GetThemeProvider();
+ canvas->FillRectInt(
+ tp->GetColor(BrowserThemeProvider::COLOR_NTP_BACKGROUND),
+ 0, 0, width(), height());
+ int alignment;
+ if (tp->GetDisplayProperty(BrowserThemeProvider::NTP_BACKGROUND_ALIGNMENT,
+ &alignment)) {
+ if (alignment & BrowserThemeProvider::ALIGN_TOP) {
+ SkBitmap* ntp_background = tp->GetBitmapNamed(IDR_THEME_NTP_BACKGROUND);
+
+ if (alignment & BrowserThemeProvider::ALIGN_LEFT) {
+ canvas->DrawBitmapInt(*ntp_background, 0, 0);
+ } else if (alignment & BrowserThemeProvider::ALIGN_RIGHT) {
+ canvas->DrawBitmapInt(*ntp_background, width() -
+ ntp_background->width(), 0);
+ } else {
+ canvas->DrawBitmapInt(*ntp_background, width() / 2-
+ ntp_background->width() / 2, 0);
+ }
+ }
+ }
+
// Draw the 'bottom' of the toolbar above our bubble.
canvas->FillRectInt(ResourceBundle::toolbar_separator_color,
0, 0, width(), 1);
« no previous file with comments | « chrome/browser/views/bookmark_bar_view.h ('k') | chrome/common/extensions/extension.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698