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

Unified Diff: ash/desktop_background/desktop_background_view.cc

Issue 9580023: Enable user change background image in settings page in Aura build. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: More refactor Created 8 years, 10 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
Index: ash/desktop_background/desktop_background_view.cc
diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc
index dbf256f0499df461eccbaff9cee46a3b78ca9305..241800560eeb697dee9233a16086307713b054c1 100644
--- a/ash/desktop_background/desktop_background_view.cc
+++ b/ash/desktop_background/desktop_background_view.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "ash/desktop_background/desktop_background_view.h"
+#include "ash/desktop_background/desktop_background_controller.h"
flackr 2012/03/05 16:16:03 This include goes below with the others. desktop_b
bshe 2012/03/06 01:33:27 Done.
#include <limits>
@@ -18,8 +19,8 @@
#include "ui/views/widget/widget.h"
namespace ash {
-namespace internal {
flackr 2012/03/05 16:16:03 nit: no newline here.
bshe 2012/03/06 01:33:27 Done.
+namespace internal {
// For our scaling ratios we need to round positive numbers.
static int RoundPositive(double x) {
return static_cast<int>(floor(x + 0.5));
@@ -37,6 +38,17 @@ DesktopBackgroundView::DesktopBackgroundView() {
DesktopBackgroundView::~DesktopBackgroundView() {
}
+void DesktopBackgroundView::SetWallpaper(const SkBitmap& wallpaper) {
+ wallpaper_ = wallpaper;
+ wallpaper_.buildMipMap(false);
+ SchedulePaint();
+}
+
+//static
+DesktopBackgroundView* DesktopBackgroundView::GetInstance() {
+ return Singleton<DesktopBackgroundView>::get();
+}
+
////////////////////////////////////////////////////////////////////////////////
// DesktopBackgroundView, views::View overrides:
@@ -92,7 +104,7 @@ views::Widget* CreateDesktopBackground() {
views::Widget* desktop_widget = new views::Widget;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
- DesktopBackgroundView* view = new DesktopBackgroundView;
+ DesktopBackgroundView* view = DesktopBackgroundView::GetInstance();
params.delegate = view;
params.parent =
Shell::GetInstance()->GetContainer(

Powered by Google App Engine
This is Rietveld 408576698