summaryrefslogtreecommitdiffstats
path: root/chrome/browser/views/infobars/infobars.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/views/infobars/infobars.cc')
-rw-r--r--chrome/browser/views/infobars/infobars.cc83
1 files changed, 38 insertions, 45 deletions
diff --git a/chrome/browser/views/infobars/infobars.cc b/chrome/browser/views/infobars/infobars.cc
index 3c5504d..71382e2 100644
--- a/chrome/browser/views/infobars/infobars.cc
+++ b/chrome/browser/views/infobars/infobars.cc
@@ -51,55 +51,48 @@ static const SkColor kPageActionBackgroundColorBottom =
static const int kSeparatorLineHeight = 1;
-// InfoBarBackground -----------------------------------------------------------
-
-class InfoBarBackground : public views::Background {
- public:
- explicit InfoBarBackground(InfoBarDelegate::Type infobar_type) {
- SkColor top_color;
- SkColor bottom_color;
- switch (infobar_type) {
- case InfoBarDelegate::INFO_TYPE:
- top_color = kInfoBackgroundColorTop;
- bottom_color = kInfoBackgroundColorBottom;
- break;
- case InfoBarDelegate::WARNING_TYPE:
- top_color = kWarningBackgroundColorTop;
- bottom_color = kWarningBackgroundColorBottom;
- break;
- case InfoBarDelegate::ERROR_TYPE:
- top_color = kErrorBackgroundColorTop;
- bottom_color = kErrorBackgroundColorBottom;
- break;
- case InfoBarDelegate::PAGE_ACTION_TYPE:
- top_color = kPageActionBackgroundColorTop;
- bottom_color = kPageActionBackgroundColorBottom;
- break;
- default:
- NOTREACHED();
- break;
- }
- gradient_background_.reset(
- views::Background::CreateVerticalGradientBackground(top_color,
- bottom_color));
+// InfoBarBackground, public: --------------------------------------------------
+
+InfoBarBackground::InfoBarBackground(InfoBarDelegate::Type infobar_type) {
+ SkColor top_color;
+ SkColor bottom_color;
+ switch (infobar_type) {
+ case InfoBarDelegate::INFO_TYPE:
+ top_color = kInfoBackgroundColorTop;
+ bottom_color = kInfoBackgroundColorBottom;
+ break;
+ case InfoBarDelegate::WARNING_TYPE:
+ top_color = kWarningBackgroundColorTop;
+ bottom_color = kWarningBackgroundColorBottom;
+ break;
+ case InfoBarDelegate::ERROR_TYPE:
+ top_color = kErrorBackgroundColorTop;
+ bottom_color = kErrorBackgroundColorBottom;
+ break;
+ case InfoBarDelegate::PAGE_ACTION_TYPE:
+ top_color = kPageActionBackgroundColorTop;
+ bottom_color = kPageActionBackgroundColorBottom;
+ break;
+ default:
+ NOTREACHED();
+ break;
}
+ gradient_background_.reset(
+ views::Background::CreateVerticalGradientBackground(top_color,
+ bottom_color));
+}
- // Overridden from views::View:
- virtual void Paint(gfx::Canvas* canvas, views::View* view) const {
- // First paint the gradient background.
- gradient_background_->Paint(canvas, view);
+// InfoBarBackground, views::Background overrides: -----------------------------
- // Now paint the separator line.
- canvas->FillRectInt(ResourceBundle::toolbar_separator_color, 0,
- view->height() - kSeparatorLineHeight, view->width(),
- kSeparatorLineHeight);
- }
+void InfoBarBackground::Paint(gfx::Canvas* canvas, views::View* view) const {
+ // First paint the gradient background.
+ gradient_background_->Paint(canvas, view);
- private:
- scoped_ptr<views::Background> gradient_background_;
-
- DISALLOW_COPY_AND_ASSIGN(InfoBarBackground);
-};
+ // Now paint the separator line.
+ canvas->FillRectInt(ResourceBundle::toolbar_separator_color, 0,
+ view->height() - kSeparatorLineHeight, view->width(),
+ kSeparatorLineHeight);
+}
// InfoBar, public: ------------------------------------------------------------