diff options
author | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-02 20:53:50 +0000 |
---|---|---|
committer | glen@chromium.org <glen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-02 20:53:50 +0000 |
commit | 7895ea23e75075fd6f9fe5a6c3dfb17d3456b208 (patch) | |
tree | d9f36ade5222fbdab94c0b40f66b456f9eba308e /chrome/browser/views | |
parent | 77be37906a16c98612360a2e35c257aa5484cf2d (diff) | |
download | chromium_src-7895ea23e75075fd6f9fe5a6c3dfb17d3456b208.zip chromium_src-7895ea23e75075fd6f9fe5a6c3dfb17d3456b208.tar.gz chromium_src-7895ea23e75075fd6f9fe5a6c3dfb17d3456b208.tar.bz2 |
Allow themes to change the background of the new tab page. Adds support for display properties to themes (stored internally as ints/enums, but parsed from text).
BUG=12768
TEST=Install a theme with an new tab page background and verify that the background appears on the new tab page.
Review URL: http://codereview.chromium.org/115910
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17431 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.cc | 30 | ||||
-rw-r--r-- | chrome/browser/views/bookmark_bar_view.h | 2 |
2 files changed, 25 insertions, 7 deletions
diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index 5621a83..f151625 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -68,7 +68,7 @@ static const int kRightMargin = 1; 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 @@ static SkBitmap* kFolderIcon = NULL; // 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,7 +559,28 @@ void BookmarkBarView::ViewHierarchyChanged(bool is_add, 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, diff --git a/chrome/browser/views/bookmark_bar_view.h b/chrome/browser/views/bookmark_bar_view.h index c32951c..23f98e3 100644 --- a/chrome/browser/views/bookmark_bar_view.h +++ b/chrome/browser/views/bookmark_bar_view.h @@ -67,6 +67,8 @@ class BookmarkBarView : public views::View, virtual void ModelChanged() = 0; }; + static const int kNewtabBarHeight; + explicit BookmarkBarView(Profile* profile, Browser* browser); virtual ~BookmarkBarView(); |