summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/detachable_toolbar_view.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 22:47:22 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 22:47:22 +0000
commit109d31f08853a4aa5c64e3b52ad7d8bf1bce7196 (patch)
treec857d0d595897144a2a22ae5dfd4ce3bbff9a212 /chrome/browser/views/detachable_toolbar_view.cc
parent1f37cf1e1302c79aa4f1854633c7b38d05432155 (diff)
downloadchromium_src-109d31f08853a4aa5c64e3b52ad7d8bf1bce7196.zip
chromium_src-109d31f08853a4aa5c64e3b52ad7d8bf1bce7196.tar.gz
chromium_src-109d31f08853a4aa5c64e3b52ad7d8bf1bce7196.tar.bz2
Windows: use NtpBackgroundUtil to draw detached bookmark bar.
BUG=23836 Review URL: http://codereview.chromium.org/268027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28618 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/detachable_toolbar_view.cc')
-rw-r--r--chrome/browser/views/detachable_toolbar_view.cc147
1 files changed, 0 insertions, 147 deletions
diff --git a/chrome/browser/views/detachable_toolbar_view.cc b/chrome/browser/views/detachable_toolbar_view.cc
index 10613bb..0664d01 100644
--- a/chrome/browser/views/detachable_toolbar_view.cc
+++ b/chrome/browser/views/detachable_toolbar_view.cc
@@ -20,39 +20,6 @@ const SkColor DetachableToolbarView::kMiddleDividerColor =
SkColorSetRGB(194, 205, 212);
// static
-void DetachableToolbarView::PaintBackgroundDetachedMode(gfx::Canvas* canvas,
- views::View* view) {
- int browser_height = view->GetParent()->GetBounds(
- views::View::APPLY_MIRRORING_TRANSFORMATION).height();
-
- // Draw the background to match the new tab page.
- ThemeProvider* tp = view->GetThemeProvider();
- canvas->FillRectInt(tp->GetColor(BrowserThemeProvider::COLOR_NTP_BACKGROUND),
- 0, 0, view->width(), view->height());
-
- if (tp->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) {
- int tiling = BrowserThemeProvider::NO_REPEAT;
- tp->GetDisplayProperty(BrowserThemeProvider::NTP_BACKGROUND_TILING,
- &tiling);
- int alignment;
- if (tp->GetDisplayProperty(BrowserThemeProvider::NTP_BACKGROUND_ALIGNMENT,
- &alignment)) {
- SkBitmap* ntp_background = tp->GetBitmapNamed(IDR_THEME_NTP_BACKGROUND);
-
- if (alignment & BrowserThemeProvider::ALIGN_TOP) {
- PaintThemeBackgroundTopAligned(
- canvas, ntp_background, tiling, alignment,
- view->width(), view->height());
- } else {
- PaintThemeBackgroundBottomAligned(
- canvas, ntp_background, tiling, alignment,
- view->width(), view->height(), browser_height);
- }
- }
- }
-}
-
-// static
void DetachableToolbarView::PaintBackgroundAttachedMode(gfx::Canvas* canvas,
views::View* view) {
gfx::Rect bounds =
@@ -153,117 +120,3 @@ void DetachableToolbarView::PaintVerticalDivider(
SkIntToScalar(height - vertical_padding) };
canvas->drawRect(rc_down, paint_down);
}
-
-// static
-void DetachableToolbarView::PaintThemeBackgroundTopAligned(
- gfx::Canvas* canvas, SkBitmap* ntp_background, int tiling, int alignment,
- int width, int height) {
- if (alignment & BrowserThemeProvider::ALIGN_LEFT) {
- if (tiling == BrowserThemeProvider::REPEAT) {
- canvas->TileImageInt(*ntp_background, 0, 0, width, height);
- } else if (tiling == BrowserThemeProvider::REPEAT_X) {
- canvas->TileImageInt(*ntp_background, 0, 0, width,
- ntp_background->height());
- } else {
- canvas->TileImageInt(*ntp_background, 0, 0,
- ntp_background->width(), ntp_background->height());
- }
- } else if (alignment & BrowserThemeProvider::ALIGN_RIGHT) {
- int x_pos = width % ntp_background->width() - ntp_background->width();
- if (tiling == BrowserThemeProvider::REPEAT) {
- canvas->TileImageInt(*ntp_background, x_pos, 0,
- width + ntp_background->width(), height);
- } else if (tiling == BrowserThemeProvider::REPEAT_X) {
- canvas->TileImageInt(*ntp_background, x_pos,
- 0, width + ntp_background->width(), ntp_background->height());
- } else {
- canvas->TileImageInt(*ntp_background, width - ntp_background->width(),
- 0, ntp_background->width(), ntp_background->height());
- }
- } else { // ALIGN == CENTER
- int x_pos = width > ntp_background->width() ?
- ((width / 2 - ntp_background->width() / 2) %
- ntp_background->width()) - ntp_background->width() :
- width / 2 - ntp_background->width() / 2;
- if (tiling == BrowserThemeProvider::REPEAT) {
- canvas->TileImageInt(*ntp_background, x_pos, 0,
- width + ntp_background->width(), height);
- } else if (tiling == BrowserThemeProvider::REPEAT_X) {
- canvas->TileImageInt(*ntp_background, x_pos, 0,
- width + ntp_background->width(),
- ntp_background->height());
- } else {
- canvas->TileImageInt(*ntp_background,
- width / 2 - ntp_background->width() / 2,
- 0, ntp_background->width(), ntp_background->height());
- }
- }
-}
-
-// static
-void DetachableToolbarView::PaintThemeBackgroundBottomAligned(
- gfx::Canvas* canvas, SkBitmap* ntp_background, int tiling, int alignment,
- int width, int height, int browser_height) {
- int border_width = 5;
- int y_pos = ((tiling == BrowserThemeProvider::REPEAT_X) ||
- (tiling == BrowserThemeProvider::NO_REPEAT)) ?
- browser_height - ntp_background->height() - height - border_width :
- browser_height % ntp_background->height() - height - border_width -
- ntp_background->height();
-
- if (alignment & BrowserThemeProvider::ALIGN_LEFT) {
- if (tiling == BrowserThemeProvider::REPEAT) {
- canvas->TileImageInt(*ntp_background, 0, y_pos, width,
- 2 * height + ntp_background->height() + 5);
- } else if (tiling == BrowserThemeProvider::REPEAT_X) {
- canvas->TileImageInt(*ntp_background, 0, y_pos, width,
- ntp_background->height());
- } else if (tiling == BrowserThemeProvider::REPEAT_Y) {
- canvas->TileImageInt(*ntp_background, 0, y_pos,
- ntp_background->width(),
- 2 * height + ntp_background->height() + 5);
- } else {
- canvas->TileImageInt(*ntp_background, 0, y_pos, ntp_background->width(),
- ntp_background->height());
- }
- } else if (alignment & BrowserThemeProvider::ALIGN_RIGHT) {
- int x_pos = width % ntp_background->width() - ntp_background->width();
- if (tiling == BrowserThemeProvider::REPEAT) {
- canvas->TileImageInt(*ntp_background, x_pos, y_pos,
- width + ntp_background->width(),
- 2 * height + ntp_background->height() + 5);
- } else if (tiling == BrowserThemeProvider::REPEAT_X) {
- canvas->TileImageInt(*ntp_background, x_pos, y_pos,
- width + ntp_background->width(), ntp_background->height());
- } else if (tiling == BrowserThemeProvider::REPEAT_Y) {
- canvas->TileImageInt(*ntp_background, width - ntp_background->width(),
- y_pos, ntp_background->width(),
- 2 * height + ntp_background->height() + 5);
- } else {
- canvas->TileImageInt(*ntp_background, width - ntp_background->width(),
- y_pos, ntp_background->width(), ntp_background->height());
- }
- } else { // ALIGN == CENTER
- int x_pos = width > ntp_background->width() ?
- ((width / 2 - ntp_background->width() / 2) %
- ntp_background->width()) - ntp_background->width() :
- width / 2 - ntp_background->width() / 2;
- if (tiling == BrowserThemeProvider::REPEAT) {
- canvas->TileImageInt(*ntp_background, x_pos, y_pos,
- width + ntp_background->width(),
- 2 * height + ntp_background->height() + 5);
- } else if (tiling == BrowserThemeProvider::REPEAT_X) {
- canvas->TileImageInt(*ntp_background, x_pos, y_pos,
- width + ntp_background->width(), ntp_background->height());
- } else if (tiling == BrowserThemeProvider::REPEAT_Y) {
- canvas->TileImageInt(*ntp_background,
- width / 2 - ntp_background->width() / 2,
- y_pos, ntp_background->width(),
- 2 * height + ntp_background->height() + 5);
- } else {
- canvas->TileImageInt(*ntp_background,
- width / 2 - ntp_background->width() / 2,
- y_pos, ntp_background->width(), ntp_background->height());
- }
- }
-}