summaryrefslogtreecommitdiffstats
path: root/chrome/views/background.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 00:34:05 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-08 00:34:05 +0000
commit2362e4fe2905ab75d3230ebc3e307ae53e2b8362 (patch)
treee6d88357a2021811e0e354f618247217be8bb3da /chrome/views/background.cc
parentdb23ac3e713dc17509b2b15d3ee634968da45715 (diff)
downloadchromium_src-2362e4fe2905ab75d3230ebc3e307ae53e2b8362.zip
chromium_src-2362e4fe2905ab75d3230ebc3e307ae53e2b8362.tar.gz
chromium_src-2362e4fe2905ab75d3230ebc3e307ae53e2b8362.tar.bz2
Move src/chrome/views to src/views. RS=darin http://crbug.com/11387
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15604 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/background.cc')
-rw-r--r--chrome/views/background.cc113
1 files changed, 0 insertions, 113 deletions
diff --git a/chrome/views/background.cc b/chrome/views/background.cc
deleted file mode 100644
index 656d0a1..0000000
--- a/chrome/views/background.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/views/background.h"
-
-#include "app/gfx/chrome_canvas.h"
-#include "base/logging.h"
-#include "chrome/views/painter.h"
-#include "chrome/views/view.h"
-#include "skia/ext/skia_utils_win.h"
-#include "skia/include/SkPaint.h"
-
-namespace views {
-
-// SolidBackground is a trivial Background implementation that fills the
-// background in a solid color.
-class SolidBackground : public Background {
- public:
- explicit SolidBackground(const SkColor& color) :
- color_(color) {
- SetNativeControlColor(color_);
- }
-
- void Paint(ChromeCanvas* canvas, View* view) const {
- // Fill the background. Note that we don't constrain to the bounds as
- // canvas is already clipped for us.
- canvas->drawColor(color_);
- }
-
- private:
- const SkColor color_;
-
- DISALLOW_EVIL_CONSTRUCTORS(SolidBackground);
-};
-
-class BackgroundPainter : public Background {
- public:
- BackgroundPainter(bool owns_painter, Painter* painter)
- : owns_painter_(owns_painter), painter_(painter) {
- DCHECK(painter);
- }
-
- virtual ~BackgroundPainter() {
- if (owns_painter_)
- delete painter_;
- }
-
-
- void Paint(ChromeCanvas* canvas, View* view) const {
- Painter::PaintPainterAt(0, 0, view->width(), view->height(), canvas,
- painter_);
- }
-
- private:
- bool owns_painter_;
- Painter* painter_;
-
- DISALLOW_EVIL_CONSTRUCTORS(BackgroundPainter);
-};
-
-Background::Background()
-#if defined(OS_WIN)
- : native_control_brush_(NULL)
-#endif
-{
-}
-
-Background::~Background() {
-#if defined(OS_WIN)
- DeleteObject(native_control_brush_);
-#endif
-}
-
-void Background::SetNativeControlColor(SkColor color) {
-#if defined(OS_WIN)
- DeleteObject(native_control_brush_);
- native_control_brush_ = CreateSolidBrush(skia::SkColorToCOLORREF(color));
-#endif
-}
-
-//static
-Background* Background::CreateSolidBackground(const SkColor& color) {
- return new SolidBackground(color);
-}
-
-//static
-Background* Background::CreateStandardPanelBackground() {
- return CreateVerticalGradientBackground(SkColorSetRGB(246, 250, 255),
- SkColorSetRGB(219, 235, 255));
-}
-
-//static
-Background* Background::CreateVerticalGradientBackground(
- const SkColor& color1, const SkColor& color2) {
- Background *background =
- CreateBackgroundPainter(true, Painter::CreateVerticalGradient(color1,
- color2));
- background->SetNativeControlColor( // 50% blend of colors 1 & 2
- SkColorSetRGB((SkColorGetR(color1) + SkColorGetR(color2)) / 2,
- (SkColorGetG(color1) + SkColorGetG(color2)) / 2,
- (SkColorGetB(color1) + SkColorGetB(color2)) / 2));
-
- return background;
-}
-
-//static
-Background* Background::CreateBackgroundPainter(bool owns_painter,
- Painter* painter) {
- return new BackgroundPainter(owns_painter, painter);
-}
-
-} // namespace views