Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(428)

Unified Diff: views/background.cc

Issue 8771006: views: Move the remaining file from views/ to ui/views/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/background.h ('k') | views/border.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/background.cc
diff --git a/views/background.cc b/views/background.cc
deleted file mode 100644
index 717261da28719f13cd1d155a6968843412753b3e..0000000000000000000000000000000000000000
--- a/views/background.cc
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright (c) 2011 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 "views/background.h"
-
-#include "base/logging.h"
-#include "skia/ext/skia_utils_win.h"
-#include "third_party/skia/include/core/SkPaint.h"
-#include "ui/gfx/canvas_skia.h"
-#include "ui/gfx/color_utils.h"
-#include "ui/views/view.h"
-#include "views/painter.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) {
- SetNativeControlColor(color);
- }
-
- void Paint(gfx::Canvas* canvas, View* view) const {
- // Fill the background. Note that we don't constrain to the bounds as
- // canvas is already clipped for us.
- canvas->GetSkCanvas()->drawColor(get_color());
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(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(gfx::Canvas* canvas, View* view) const {
- Painter::PaintPainterAt(0, 0, view->width(), view->height(), canvas,
- painter_);
- }
-
- private:
- bool owns_painter_;
- Painter* painter_;
-
- DISALLOW_COPY_AND_ASSIGN(BackgroundPainter);
-};
-
-Background::Background()
- : color_(SK_ColorWHITE)
-#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) {
- color_ = color;
-#if defined(OS_WIN)
- DeleteObject(native_control_brush_);
- native_control_brush_ = NULL;
-#endif
-}
-
-#if defined(OS_WIN)
-HBRUSH Background::GetNativeControlBrush() const {
- if (!native_control_brush_)
- native_control_brush_ = CreateSolidBrush(skia::SkColorToCOLORREF(color_));
- return native_control_brush_;
-}
-#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(
- color_utils::AlphaBlend(color1, color2, 128));
-
- return background;
-}
-
-//static
-Background* Background::CreateBackgroundPainter(bool owns_painter,
- Painter* painter) {
- return new BackgroundPainter(owns_painter, painter);
-}
-
-} // namespace views
« no previous file with comments | « views/background.h ('k') | views/border.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698