OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/ntp_background_util.h" | 5 #include "chrome/browser/ui/ntp_background_util.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/themes/theme_properties.h" | 10 #include "chrome/browser/themes/theme_properties.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // static | 68 // static |
69 void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp, | 69 void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp, |
70 gfx::Canvas* canvas, | 70 gfx::Canvas* canvas, |
71 const gfx::Rect& area, | 71 const gfx::Rect& area, |
72 int tab_contents_height) { | 72 int tab_contents_height) { |
73 // Draw the background to match the new tab page. | 73 // Draw the background to match the new tab page. |
74 canvas->FillRect(area, tp->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND)); | 74 canvas->FillRect(area, tp->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND)); |
75 | 75 |
76 if (tp->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) { | 76 if (tp->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) { |
77 int tiling = ThemeProperties::NO_REPEAT; | 77 int tiling = tp->GetDisplayProperty(ThemeProperties::NTP_BACKGROUND_TILING); |
78 tp->GetDisplayProperty(ThemeProperties::NTP_BACKGROUND_TILING, &tiling); | 78 int alignment = tp->GetDisplayProperty( |
79 int alignment; | 79 ThemeProperties::NTP_BACKGROUND_ALIGNMENT); |
80 if (tp->GetDisplayProperty(ThemeProperties::NTP_BACKGROUND_ALIGNMENT, | 80 gfx::ImageSkia* ntp_background = |
81 &alignment)) { | 81 tp->GetImageSkiaNamed(IDR_THEME_NTP_BACKGROUND); |
82 gfx::ImageSkia* ntp_background = | |
83 tp->GetImageSkiaNamed(IDR_THEME_NTP_BACKGROUND); | |
84 | 82 |
85 PaintThemeBackground( | 83 PaintThemeBackground( |
86 canvas, ntp_background, tiling, alignment, area, tab_contents_height); | 84 canvas, ntp_background, tiling, alignment, area, tab_contents_height); |
87 } | |
88 } | 85 } |
89 } | 86 } |
OLD | NEW |