Skip to content

Commit

Permalink
Revert 126319 - Enable user change background image in settings page …
Browse files Browse the repository at this point in the history
…in Aura build.

Only support change between default background images currently.
Need more refactor work on code.

BUG=105508
TEST=


Review URL: http://codereview.chromium.org/9580023

TBR=bshe@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9695033

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126328 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sky@chromium.org committed Mar 13, 2012
1 parent 2a7f4ca commit 135b70b
Show file tree
Hide file tree
Showing 37 changed files with 77 additions and 846 deletions.
11 changes: 4 additions & 7 deletions ash/accelerators/accelerator_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "ash/accelerators/accelerator_controller.h"

#include "ash/accelerators/accelerator_table.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/ash_switches.h"
#include "ash/caps_lock_delegate.h"
#include "ash/ime_control_delegate.h"
Expand Down Expand Up @@ -91,13 +90,11 @@ bool HandleRotateScreen() {
}

bool HandleToggleDesktopBackgroundMode() {
ash::DesktopBackgroundController* desktop_background_controller =
ash::Shell::GetInstance()->desktop_background_controller();
if (desktop_background_controller->desktop_background_mode() ==
ash::DesktopBackgroundController::BACKGROUND_IMAGE)
desktop_background_controller->SetDesktopBackgroundSolidColorMode();
ash::Shell* shell = ash::Shell::GetInstance();
if (shell->desktop_background_mode() == ash::Shell::BACKGROUND_IMAGE)
shell->SetDesktopBackgroundMode(ash::Shell::BACKGROUND_SOLID_COLOR);
else
desktop_background_controller->SetPreviousDesktopBackgroundImage();
shell->SetDesktopBackgroundMode(ash::Shell::BACKGROUND_IMAGE);
return true;
}

Expand Down
4 changes: 0 additions & 4 deletions ash/ash.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@
'ash_switches.cc',
'ash_switches.h',
'caps_lock_delegate.h',
'desktop_background/desktop_background_controller.cc',
'desktop_background/desktop_background_controller.h',
'desktop_background/desktop_background_resources.cc',
'desktop_background/desktop_background_resources.h',
'desktop_background/desktop_background_view.cc',
'desktop_background/desktop_background_view.h',
'drag_drop/drag_drop_controller.cc',
Expand Down
77 changes: 0 additions & 77 deletions ash/desktop_background/desktop_background_controller.cc

This file was deleted.

66 changes: 0 additions & 66 deletions ash/desktop_background/desktop_background_controller.h

This file was deleted.

67 changes: 0 additions & 67 deletions ash/desktop_background/desktop_background_resources.cc

This file was deleted.

19 changes: 0 additions & 19 deletions ash/desktop_background/desktop_background_resources.h

This file was deleted.

15 changes: 5 additions & 10 deletions ash/desktop_background/desktop_background_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,15 @@ static int RoundPositive(double x) {
////////////////////////////////////////////////////////////////////////////////
// DesktopBackgroundView, public:

DesktopBackgroundView::DesktopBackgroundView(const SkBitmap& wallpaper) {
wallpaper_ = wallpaper;
DesktopBackgroundView::DesktopBackgroundView() {
wallpaper_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed(
IDR_AURA_WALLPAPER_1).ToSkBitmap();
wallpaper_.buildMipMap(false);
}

DesktopBackgroundView::~DesktopBackgroundView() {
}

void DesktopBackgroundView::SetWallpaper(const SkBitmap& wallpaper) {
wallpaper_ = wallpaper;
wallpaper_.buildMipMap(false);
SchedulePaint();
}

////////////////////////////////////////////////////////////////////////////////
// DesktopBackgroundView, views::View overrides:

Expand Down Expand Up @@ -93,11 +88,11 @@ void DesktopBackgroundView::OnMouseReleased(const views::MouseEvent& event) {
Shell::GetInstance()->ShowBackgroundMenu(GetWidget(), event.location());
}

views::Widget* CreateDesktopBackground(const SkBitmap& wallpaper) {
views::Widget* CreateDesktopBackground() {
views::Widget* desktop_widget = new views::Widget;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
DesktopBackgroundView* view = new DesktopBackgroundView(wallpaper);
DesktopBackgroundView* view = new DesktopBackgroundView;
params.delegate = view;
params.parent =
Shell::GetInstance()->GetContainer(
Expand Down
9 changes: 2 additions & 7 deletions ash/desktop_background/desktop_background_view.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// 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.

Expand All @@ -15,14 +15,9 @@ namespace internal {

class DesktopBackgroundView : public views::WidgetDelegateView {
public:
DesktopBackgroundView(const SkBitmap& wallpaper);
DesktopBackgroundView();
virtual ~DesktopBackgroundView();

// TODO(bshe): Remove this function once issue 117244 is fixed. It is
// currently used in DesktopBackgroundController::
// OnDesktopBackgroundChanged.
void SetWallpaper(const SkBitmap& wallpaper);

private:
// Overridden from views::View:
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
Expand Down
30 changes: 23 additions & 7 deletions ash/shell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

#include "ash/app_list/app_list.h"
#include "ash/ash_switches.h"
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/desktop_background/desktop_background_resources.h"
#include "ash/desktop_background/desktop_background_view.h"
#include "ash/drag_drop/drag_drop_controller.h"
#include "ash/focus_cycler.h"
#include "ash/ime/input_method_event_filter.h"
Expand Down Expand Up @@ -316,6 +313,7 @@ Shell::Shell(ShellDelegate* delegate)
network_controller_(NULL),
power_status_controller_(NULL),
shelf_(NULL),
desktop_background_mode_(BACKGROUND_IMAGE),
root_window_layout_(NULL),
status_widget_(NULL) {
}
Expand Down Expand Up @@ -485,9 +483,6 @@ void Shell::Init() {
GetContainer(internal::kShellWindowId_DefaultContainer);
launcher_.reset(new Launcher(default_container));

// This controller needs to be set before SetupManagedWindowMode.
desktop_background_controller_.reset(new DesktopBackgroundController);

InitLayoutManagers();

if (!command_line->HasSwitch(switches::kAuraNoShadows))
Expand Down Expand Up @@ -551,6 +546,27 @@ void Shell::ToggleAppList() {
app_list_->SetVisible(!app_list_->IsVisible());
}

void Shell::SetDesktopBackgroundMode(BackgroundMode mode) {
if (mode == BACKGROUND_SOLID_COLOR) {
// Set a solid black background.
// TODO(derat): Remove this in favor of having the compositor only clear the
// viewport when there are regions not covered by a layer:
// http://crbug.com/113445
ui::Layer* background_layer = new ui::Layer(ui::Layer::LAYER_SOLID_COLOR);
background_layer->SetColor(SK_ColorBLACK);
GetContainer(internal::kShellWindowId_DesktopBackgroundContainer)->
layer()->Add(background_layer);
root_window_layout_->SetBackgroundLayer(background_layer);
root_window_layout_->SetBackgroundWidget(NULL);
} else {
// Create the desktop background image.
root_window_layout_->SetBackgroundLayer(NULL);
root_window_layout_->SetBackgroundWidget(
internal::CreateDesktopBackground());
}
desktop_background_mode_ = mode;
}

bool Shell::IsScreenLocked() const {
const aura::Window* lock_screen_container = GetContainer(
internal::kShellWindowId_LockScreenContainer);
Expand Down Expand Up @@ -610,7 +626,7 @@ void Shell::InitLayoutManagers() {
launcher_->widget()->Show();

// Create the desktop background image.
desktop_background_controller_->SetDefaultDesktopBackgroundImage();
SetDesktopBackgroundMode(BACKGROUND_IMAGE);
}

void Shell::DisableWorkspaceGridLayout() {
Expand Down
Loading

0 comments on commit 135b70b

Please sign in to comment.