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

Unified Diff: chrome/browser/ui/ntp_background_util.cc

Issue 366203002: Cleanup: Remove unused ntp_background_util.* component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASE Created 6 years, 5 months 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 | « chrome/browser/ui/ntp_background_util.h ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/ntp_background_util.cc
diff --git a/chrome/browser/ui/ntp_background_util.cc b/chrome/browser/ui/ntp_background_util.cc
deleted file mode 100644
index d10ea288d306df0406c57255e0359cfd0b379b2f..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/ntp_background_util.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2012 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/browser/ui/ntp_background_util.h"
-
-#include <cmath>
-
-#include "base/logging.h"
-#include "chrome/browser/themes/theme_properties.h"
-#include "grit/theme_resources.h"
-#include "ui/base/theme_provider.h"
-#include "ui/gfx/canvas.h"
-#include "ui/gfx/image/image_skia.h"
-#include "ui/gfx/rect.h"
-#include "ui/gfx/skia_util.h"
-
-namespace {
-
-void PaintThemeBackground(
- gfx::Canvas* canvas, gfx::ImageSkia* ntp_background, int tiling,
- int alignment, const gfx::Rect& area, int tab_contents_height) {
- int x_pos = 0;
- int y_pos = 0;
- int width = area.width() + ntp_background->width();
- int height = area.height() + ntp_background->height();
-
- if (alignment & ThemeProperties::ALIGN_BOTTOM) {
- y_pos += area.height() + tab_contents_height - ntp_background->height();
- } else if (alignment & ThemeProperties::ALIGN_TOP) {
- // no op
- } else { // ALIGN_CENTER
- y_pos += std::floor(area.height() + tab_contents_height / 2.0 -
- ntp_background->height() / 2.0 + 0.5);
- }
-
- if (alignment & ThemeProperties::ALIGN_RIGHT) {
- x_pos += area.width() - ntp_background->width();
- } else if (alignment & ThemeProperties::ALIGN_LEFT) {
- // no op
- } else { // ALIGN_CENTER
- x_pos +=
- std::floor(area.width() / 2.0 - ntp_background->width() / 2.0 + 0.5);
- }
-
- if (tiling != ThemeProperties::REPEAT &&
- tiling != ThemeProperties::REPEAT_X) {
- width = ntp_background->width();
- } else if (x_pos > 0) {
- x_pos = x_pos % ntp_background->width() - ntp_background->width();
- }
-
- if (tiling != ThemeProperties::REPEAT &&
- tiling != ThemeProperties::REPEAT_Y) {
- height = ntp_background->height();
- } else if (y_pos > 0) {
- y_pos = y_pos % ntp_background->height() - ntp_background->height();
- }
-
- x_pos += area.x();
- y_pos += area.y();
-
- canvas->TileImageInt(*ntp_background, x_pos, y_pos, width, height);
-}
-
-} // namespace
-
-// static
-void NtpBackgroundUtil::PaintBackgroundDetachedMode(ui::ThemeProvider* tp,
- gfx::Canvas* canvas,
- const gfx::Rect& area,
- int tab_contents_height) {
- // Draw the background to match the new tab page.
- canvas->FillRect(area, tp->GetColor(ThemeProperties::COLOR_NTP_BACKGROUND));
-
- if (tp->HasCustomImage(IDR_THEME_NTP_BACKGROUND)) {
- int tiling = tp->GetDisplayProperty(ThemeProperties::NTP_BACKGROUND_TILING);
- int alignment = tp->GetDisplayProperty(
- ThemeProperties::NTP_BACKGROUND_ALIGNMENT);
- gfx::ImageSkia* ntp_background =
- tp->GetImageSkiaNamed(IDR_THEME_NTP_BACKGROUND);
-
- PaintThemeBackground(
- canvas, ntp_background, tiling, alignment, area, tab_contents_height);
- }
-}
« no previous file with comments | « chrome/browser/ui/ntp_background_util.h ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698