Commit 8fd386fa authored by sadrul@chromium.org's avatar sadrul@chromium.org

Revert 149869 because it broke ash_unittests on win_aura and linux_chromeos.

"""
2nd display should show the same background as login/lock screen:

Added special container for background on lock screen.
Background view can now be created in specific container.
Disabled lock screen wallpaper implementation based on serving PNG image via data source.

BUG=136853,137581
TEST=Lock screen on multimonitor configuration. Check that windows on secondary display are hidden with background.

Review URL: https://chromiumcodereview.appspot.com/10810039

TBR=antrim@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10829173

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149878 0039d316-1c4b-4281-b951-d872f2087c98
parent 66edcb54
......@@ -63,8 +63,6 @@
'desktop_background/desktop_background_resources.h',
'desktop_background/desktop_background_view.cc',
'desktop_background/desktop_background_view.h',
'desktop_background/desktop_background_widget_controller.cc',
'desktop_background/desktop_background_widget_controller.h',
'display/display_controller.cc',
'display/display_controller.h',
'display/mouse_cursor_event_filter.cc',
......
......@@ -5,7 +5,6 @@
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/desktop_background/desktop_background_view.h"
#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/shell.h"
#include "ash/shell_factory.h"
#include "ash/shell_window_ids.h"
......@@ -19,7 +18,6 @@
#include "ui/aura/window.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/image/image.h"
#include "ui/views/widget/widget.h"
......@@ -93,11 +91,9 @@ class DesktopBackgroundController::WallpaperOperation
};
DesktopBackgroundController::DesktopBackgroundController()
: locked_(false),
desktop_background_mode_(BACKGROUND_SOLID_COLOR),
: desktop_background_mode_(BACKGROUND_IMAGE),
background_color_(SK_ColorGRAY),
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
InstallComponentForAllWindows();
}
DesktopBackgroundController::~DesktopBackgroundController() {
......@@ -124,16 +120,27 @@ SkBitmap DesktopBackgroundController::GetCurrentWallpaperImage() {
void DesktopBackgroundController::OnRootWindowAdded(
aura::RootWindow* root_window) {
InstallComponent(root_window);
switch (desktop_background_mode_) {
case BACKGROUND_IMAGE:
if (current_wallpaper_.get()) {
SetDesktopBackgroundImage(root_window);
} else {
internal::CreateDesktopBackground(root_window);
}
break;
case BACKGROUND_SOLID_COLOR:
SetDesktopBackgroundSolidColorMode(background_color_);
break;
}
}
void DesktopBackgroundController::SetDefaultWallpaper(int index) {
// We should not change background when index is invalid. For instance, at
// login screen or stub_user login.
if (index == GetInvalidWallpaperIndex()) {
if (index == ash::GetInvalidWallpaperIndex()) {
CreateEmptyWallpaper();
return;
} else if (index == GetSolidColorIndex()) {
} else if (index == ash::GetSolidColorIndex()) {
SetDesktopBackgroundSolidColorMode(kLoginWallpaperColor);
return;
}
......@@ -158,7 +165,8 @@ void DesktopBackgroundController::SetCustomWallpaper(
WallpaperLayout layout) {
CancelPendingWallpaperOperation();
current_wallpaper_.reset(new WallpaperData(layout, wallpaper));
SetDesktopBackgroundImageMode();
desktop_background_mode_ = BACKGROUND_IMAGE;
UpdateDesktopBackgroundImageMode();
}
void DesktopBackgroundController::CancelPendingWallpaperOperation() {
......@@ -172,142 +180,65 @@ void DesktopBackgroundController::CancelPendingWallpaperOperation() {
void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode(
SkColor 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
current_wallpaper_.reset(NULL);
background_color_ = color;
if (desktop_background_mode_ != BACKGROUND_SOLID_COLOR) {
desktop_background_mode_ = BACKGROUND_SOLID_COLOR;
InstallComponentForAllWindows();
return;
}
desktop_background_mode_ = BACKGROUND_SOLID_COLOR;
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
for (Shell::RootWindowList::iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR);
background_layer->SetColor(color);
aura::RootWindow* root_window = *iter;
internal::DesktopBackgroundWidgetController* component = root_window->
GetProperty(internal::kWindowDesktopComponent);
DCHECK(component);
DCHECK(component->layer());
component->layer()->SetColor(background_color_ );
Shell::GetContainer(
root_window,
internal::kShellWindowId_DesktopBackgroundContainer)->
layer()->Add(background_layer);
GetRootWindowLayoutManager(root_window)->SetBackgroundLayer(
background_layer);
GetRootWindowLayoutManager(root_window)->SetBackgroundWidget(NULL);
}
}
void DesktopBackgroundController::CreateEmptyWallpaper() {
current_wallpaper_.reset(NULL);
SetDesktopBackgroundImageMode();
}
void DesktopBackgroundController::MoveDesktopToLockedContainer() {
if (locked_)
return;
locked_ = true;
ReparentBackgroundWidgets(GetBackgroundContainerId(false),
GetBackgroundContainerId(true));
}
void DesktopBackgroundController::MoveDesktopToUnlockedContainer() {
if (!locked_)
return;
locked_ = false;
ReparentBackgroundWidgets(GetBackgroundContainerId(true),
GetBackgroundContainerId(false));
void DesktopBackgroundController::SetDesktopBackgroundImage(
aura::RootWindow* root_window) {
GetRootWindowLayoutManager(root_window)->SetBackgroundLayer(NULL);
if (current_wallpaper_.get() &&
!current_wallpaper_->wallpaper_image.empty())
internal::CreateDesktopBackground(root_window);
}
void DesktopBackgroundController::SetDesktopBackgroundImageMode() {
if (desktop_background_mode_ != BACKGROUND_IMAGE) {
desktop_background_mode_ = BACKGROUND_IMAGE;
InstallComponentForAllWindows();
return;
}
void DesktopBackgroundController::UpdateDesktopBackgroundImageMode() {
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
for (Shell::RootWindowList::iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
aura::RootWindow* root_window = *iter;
internal::DesktopBackgroundWidgetController* component = root_window->
GetProperty(internal::kWindowDesktopComponent);
DCHECK(component);
DCHECK(component->widget());
aura::Window* window = component->widget()->GetNativeView();
gfx::Rect bounds = window->bounds();
window->SchedulePaintInRect(gfx::Rect(0, 0,
bounds.width(), bounds.height()));
iter != root_windows.end(); ++iter) {
SetDesktopBackgroundImage(*iter);
}
desktop_background_mode_ = BACKGROUND_IMAGE;
}
void DesktopBackgroundController::OnWallpaperLoadCompleted(
scoped_refptr<WallpaperOperation> wo) {
current_wallpaper_.reset(wo->ReleaseWallpaperData());
SetDesktopBackgroundImageMode();
UpdateDesktopBackgroundImageMode();
DCHECK(wo.get() == wallpaper_op_.get());
wallpaper_op_ = NULL;
}
ui::Layer* DesktopBackgroundController::SetColorLayerForContainer(
SkColor color,
aura::RootWindow* root_window,
int container_id) {
ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR);
background_layer->SetColor(color);
Shell::GetContainer(root_window,container_id)->
layer()->Add(background_layer);
return background_layer;
}
void DesktopBackgroundController::InstallComponent(
aura::RootWindow* root_window) {
internal::DesktopBackgroundWidgetController* component = NULL;
int container_id = GetBackgroundContainerId(locked_);
switch (desktop_background_mode_) {
case BACKGROUND_IMAGE: {
views::Widget* widget = internal::CreateDesktopBackground(root_window,
container_id);
component = new internal::DesktopBackgroundWidgetController(widget);
break;
}
case BACKGROUND_SOLID_COLOR: {
ui::Layer* layer = SetColorLayerForContainer(background_color_,
root_window,
container_id);
component = new internal::DesktopBackgroundWidgetController(layer);
break;
}
default: {
NOTREACHED();
}
}
root_window->SetProperty(internal::kWindowDesktopComponent, component);
}
void DesktopBackgroundController::InstallComponentForAllWindows() {
void DesktopBackgroundController::CreateEmptyWallpaper() {
current_wallpaper_.reset(NULL);
desktop_background_mode_ = BACKGROUND_IMAGE;
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
for (Shell::RootWindowList::iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
InstallComponent(*iter);
internal::CreateDesktopBackground(*iter);
}
}
void DesktopBackgroundController::ReparentBackgroundWidgets(int src_container,
int dst_container) {
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
for (Shell::RootWindowList::iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
aura::RootWindow* root_window = *iter;
internal::DesktopBackgroundWidgetController* component = root_window->
GetProperty(internal::kWindowDesktopComponent);
DCHECK(component);
component->Reparent(root_window,
src_container,
dst_container);
}
}
int DesktopBackgroundController::GetBackgroundContainerId(bool locked) {
return locked ? internal::kShellWindowId_LockScreenBackgroundContainer :
internal::kShellWindowId_DesktopBackgroundContainer;
}
} // namespace ash
......@@ -13,7 +13,6 @@
#include "base/memory/weak_ptr.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/image/image_skia.h"
namespace aura {
......@@ -95,49 +94,25 @@ class ASH_EXPORT DesktopBackgroundController {
// is SystemGestureEventFilterTest.ThreeFingerSwipe.
void CreateEmptyWallpaper();
// Move all desktop widgets to locked container.
void MoveDesktopToLockedContainer();
// Move all desktop widgets to unlocked container.
void MoveDesktopToUnlockedContainer();
private:
// An operation to asynchronously loads wallpaper.
class WallpaperOperation;
struct WallpaperData;
// Creates view for all root windows, or notifies them to repaint if they
// already exist.
void SetDesktopBackgroundImageMode();
// Creates a new background widget using the current wallpapaer image and
// use it as a background of the |root_window|. Deletes the old widget if any.
void SetDesktopBackgroundImage(aura::RootWindow* root_window);
// Update the background of all root windows using the current wallpaper image
// in |current_wallpaper_|.
void UpdateDesktopBackgroundImageMode();
// Creates a new background widget and sets the background mode to image mode.
// Called after wallpaper loaded successfully.
void OnWallpaperLoadCompleted(scoped_refptr<WallpaperOperation> wo);
// Adds layer with solid |color| to container |container_id| in |root_window|.
ui::Layer* SetColorLayerForContainer(SkColor color,
aura::RootWindow* root_window,
int container_id);
// Creates and adds component for current mode (either Widget or Layer) to
// |root_window|.
void InstallComponent(aura::RootWindow* root_window);
// Creates and adds component for current mode (either Widget or Layer) to
// all root windows.
void InstallComponentForAllWindows();
// Moves all descktop components from one container to other across all root
// windows.
void ReparentBackgroundWidgets(int src_container, int dst_container);
// Returns id for background container for unlocked and locked states.
int GetBackgroundContainerId(bool locked);
// Can change at runtime.
bool locked_;
BackgroundMode desktop_background_mode_;
SkColor background_color_;
......
......@@ -10,6 +10,7 @@
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/root_window_layout_manager.h"
#include "ash/wm/window_animations.h"
#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
......@@ -30,10 +31,8 @@ namespace {
class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver {
public:
ShowWallpaperAnimationObserver(aura::RootWindow* root_window,
int container_id,
views::Widget* desktop_widget)
: root_window_(root_window),
container_id_(container_id),
desktop_widget_(desktop_widget) {
}
......@@ -43,6 +42,11 @@ class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver {
private:
// Overridden from ui::ImplicitAnimationObserver:
virtual void OnImplicitAnimationsCompleted() OVERRIDE {
internal::RootWindowLayoutManager* root_window_layout =
static_cast<internal::RootWindowLayoutManager*>(
root_window_->layout_manager());
root_window_layout->SetBackgroundWidget(desktop_widget_);
ash::Shell::GetInstance()->
user_wallpaper_delegate()->OnWallpaperAnimationFinished();
......@@ -50,7 +54,6 @@ class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver {
}
aura::RootWindow* root_window_;
int container_id_;
views::Widget* desktop_widget_;
DISALLOW_COPY_AND_ASSIGN(ShowWallpaperAnimationObserver);
......@@ -135,8 +138,7 @@ void DesktopBackgroundView::ShowContextMenuForView(views::View* source,
Shell::GetInstance()->ShowBackgroundMenu(GetWidget(), point);
}
views::Widget* CreateDesktopBackground(aura::RootWindow* root_window,
int container_id) {
void CreateDesktopBackground(aura::RootWindow* root_window) {
DesktopBackgroundController* controller = ash::Shell::GetInstance()->
desktop_background_controller();
views::Widget* desktop_widget = new views::Widget;
......@@ -146,7 +148,8 @@ views::Widget* CreateDesktopBackground(aura::RootWindow* root_window,
params.delegate = view;
if (controller->GetWallpaper().empty())
params.transparent = true;
params.parent = root_window->GetChildById(container_id);
params.parent = root_window->GetChildById(
ash::internal::kShellWindowId_DesktopBackgroundContainer);
desktop_widget->Init(params);
desktop_widget->SetContentsView(view);
ash::WindowVisibilityAnimationType animation_type =
......@@ -160,11 +163,9 @@ views::Widget* CreateDesktopBackground(aura::RootWindow* root_window,
desktop_widget->GetNativeView()->layer()->GetAnimator());
settings.SetPreemptionStrategy(ui::LayerAnimator::ENQUEUE_NEW_ANIMATION);
settings.AddObserver(new ShowWallpaperAnimationObserver(root_window,
container_id,
desktop_widget));
desktop_widget->Show();
desktop_widget->GetNativeView()->SetName("DesktopBackgroundView");
return desktop_widget;
}
} // namespace internal
......
// 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 "ash/desktop_background/desktop_background_widget_controller.h"
#include "ui/aura/root_window.h"
#include "ui/views/widget/widget.h"
DECLARE_WINDOW_PROPERTY_TYPE(ash::internal::DesktopBackgroundWidgetController*);
namespace ash {
namespace internal {
DEFINE_OWNED_WINDOW_PROPERTY_KEY(DesktopBackgroundWidgetController,
kWindowDesktopComponent, NULL);
DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
views::Widget* widget) : widget_(widget) {
}
DesktopBackgroundWidgetController::DesktopBackgroundWidgetController(
ui::Layer* layer) : widget_(NULL) {
layer_.reset(layer);
}
DesktopBackgroundWidgetController::~DesktopBackgroundWidgetController() {
if (widget_) {
widget_->CloseNow();
widget_ = NULL;
} else if (layer_.get())
layer_.reset(NULL);
}
void DesktopBackgroundWidgetController::SetBounds(gfx::Rect bounds) {
if (widget_)
widget_->SetBounds(bounds);
else if (layer_.get())
layer_->SetBounds(bounds);
}
void DesktopBackgroundWidgetController::Reparent(aura::RootWindow* root_window,
int src_container,
int dest_container) {
if (widget_) {
views::Widget::ReparentNativeView(widget_->GetNativeView(),
root_window->GetChildById(dest_container));
} else if (layer_.get()) {
ui::Layer* layer = layer_.get();
root_window->GetChildById(src_container)->layer()->Remove(layer);
root_window->GetChildById(dest_container)->layer()->Add(layer);
}
}
} // namespace internal
} // namespace ash
// 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.
#ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_
#define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_
#include "base/memory/scoped_ptr.h"
#include "ui/aura/window_property.h"
#include "ui/compositor/layer.h"
#include "ui/views/widget/widget.h"
namespace ash {
namespace internal {
// This class hides difference between two possible background implementations:
// effective Layer-based for solid color, and Widget-based for images.
class DesktopBackgroundWidgetController {
public:
// Create
explicit DesktopBackgroundWidgetController(views::Widget* widget);
explicit DesktopBackgroundWidgetController(ui::Layer* layer);
~DesktopBackgroundWidgetController();
// Set bounds of component that draws background.
void SetBounds(gfx::Rect bounds);
// Move component from |src_container| in |root_window| to |dest_container|.
// It is required for lock screen, when we need to move background so that
// it hides user's windows.
void Reparent(aura::RootWindow* root_window,
int src_container,
int dest_container);
views::Widget* widget() { return widget_; }
ui::Layer* layer() { return layer_.get(); }
private:
views::Widget* widget_;
scoped_ptr<ui::Layer> layer_;
DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundWidgetController);
};
// Window property key, that binds instance of DesktopBackgroundWidgetController
// to root windows.
extern const aura::WindowProperty<DesktopBackgroundWidgetController*>* const
kWindowDesktopComponent;
} // namespace internal
} // namespace ash
#endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_
......@@ -6,7 +6,6 @@
#include <vector>
#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/display/display_controller.h"
#include "ash/shell.h"
#include "ash/shell_factory.h"
......@@ -170,13 +169,6 @@ void CreateContainersInRootWindow(aura::RootWindow* root_window) {
non_lock_screen_containers);
SetUsesScreenCoordinates(input_method_container);
aura::Window* lock_background_containers = CreateContainer(
internal::kShellWindowId_LockScreenBackgroundContainer,
"LockScreenBackgroundContainer",
lock_screen_containers);
SetChildWindowVisibilityChangesAnimated(lock_background_containers);
// TODO(beng): Figure out if we can make this use
// SystemModalContainerEventFilter instead of stops_event_propagation.
aura::Window* lock_container = CreateContainer(
......@@ -286,9 +278,7 @@ void RootWindowController::CreateContainers() {
void RootWindowController::CloseChildWindows() {
// Close background widget first as it depends on tooltip.
root_window_->SetProperty(kWindowDesktopComponent,
static_cast<DesktopBackgroundWidgetController*>(NULL));
root_window_layout_->SetBackgroundWidget(NULL);
workspace_controller_.reset();
aura::client::SetTooltipClient(root_window_.get(), NULL);
......
......@@ -30,8 +30,7 @@ class Widget;
namespace ash {
namespace internal {
views::Widget* CreateDesktopBackground(aura::RootWindow* root_window,
int container_id);
void CreateDesktopBackground(aura::RootWindow* root_window);
ASH_EXPORT views::Widget* CreateStatusArea(views::View* contents);
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "ash/ash_switches.h"
#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/launcher/launcher.h"
#include "ash/shell.h"
#include "ash/shell_delegate.h"
......@@ -58,8 +57,6 @@ void ExpectAllContainers() {
root_window, internal::kShellWindowId_LauncherContainer));
EXPECT_TRUE(Shell::GetContainer(
root_window, internal::kShellWindowId_SystemModalContainer));
EXPECT_TRUE(Shell::GetContainer(
root_window, internal::kShellWindowId_LockScreenBackgroundContainer));
EXPECT_TRUE(Shell::GetContainer(
root_window, internal::kShellWindowId_LockScreenContainer));
EXPECT_TRUE(Shell::GetContainer(
......@@ -274,13 +271,8 @@ TEST_F(ShellTest, MAYBE_ManagedWindowModeBasics) {
EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHostSize().height(),
launcher_widget->GetWindowBoundsInScreen().bottom());
// We have a desktop background but not a bare layer.
// TODO (antrim): enable once we find out why it fails component build.
// internal::DesktopBackgroundWidgetController* background =
// Shell::GetPrimaryRootWindow()->
// GetProperty(internal::kWindowDesktopComponent);
// EXPECT_TRUE(background);
// EXPECT_TRUE(background->widget());
// EXPECT_FALSE(background->layer());
EXPECT_TRUE(test_api.root_window_layout()->background_widget());
EXPECT_FALSE(test_api.root_window_layout()->background_layer());
// Create a normal window. It is not maximized.
views::Widget::InitParams widget_params(
......
......@@ -57,31 +57,28 @@ const int kShellWindowId_SystemModalContainer = 10;
// the AppList and SystemModal dialogs.
const int kShellWindowId_InputMethodContainer = 11;
// The container for the lock screen background.
const int kShellWindowId_LockScreenBackgroundContainer = 12;
// The container for the lock screen.
const int kShellWindowId_LockScreenContainer = 13;
const int kShellWindowId_LockScreenContainer = 12;
// The container for the lock screen modal windows.
const int kShellWindowId_LockSystemModalContainer = 14;
const int kShellWindowId_LockSystemModalContainer = 13;
// The container for the status area.
const int kShellWindowId_StatusContainer = 15;
const int kShellWindowId_StatusContainer = 14;
// The container for menus.
const int kShellWindowId_MenuContainer = 16;
const int kShellWindowId_MenuContainer = 15;
// The container for drag/drop images and tooltips.
const int kShellWindowId_DragImageAndTooltipContainer = 17;
const int kShellWindowId_DragImageAndTooltipContainer = 16;
// The container for bubbles briefly overlaid onscreen to show settings changes
// (volume, brightness, etc.).
const int kShellWindowId_SettingBubbleContainer = 18;
const int kShellWindowId_SettingBubbleContainer = 17;
// The container for special components overlaid onscreen, such as the
// region selector for partial screenshots.
const int kShellWindowId_OverlayContainer = 19;
const int kShellWindowId_OverlayContainer = 18;
} // namespace internal
......
......@@ -4,7 +4,6 @@
#include "ash/wm/root_window_layout_manager.h"
#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/views/widget/widget.h"
......@@ -16,12 +15,25 @@ namespace internal {
// RootWindowLayoutManager, public:
RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner)
: owner_(owner) {
: owner_(owner),
background_widget_(NULL) {
}
RootWindowLayoutManager::~RootWindowLayoutManager() {
}
void RootWindowLayoutManager::SetBackgroundWidget(views::Widget* widget) {
if (widget == background_widget_)
return;
// Close now so that the focus manager will be deleted before shutdown.
if (background_widget_)
background_widget_->CloseNow();
background_widget_ = widget;
}
void RootWindowLayoutManager::SetBackgroundLayer(ui::Layer* layer) {
background_layer_.reset(layer);
}
////////////////////////////////////////////////////////////////////////////////
// RootWindowLayoutManager, aura::LayoutManager implementation:
......@@ -39,10 +51,11 @@ void RootWindowLayoutManager::OnWindowResized() {
for (j = (*i)->children().begin(); j != (*i)->children().end(); ++j)
(*j)->SetBounds(fullscreen_bounds);
}
internal::DesktopBackgroundWidgetController* background =
owner_->GetProperty(internal::kWindowDesktopComponent);
if (background)
background->SetBounds(fullscreen_bounds);
if (background_widget_)
background_widget_->SetBounds(fullscreen_bounds);
if (background_layer_.get())
background_layer_->SetBounds(fullscreen_bounds);
}
void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) {
......
......@@ -5,7 +5,6 @@
#ifndef ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_
#define ASH_WM_ROOT_WINDOW_LAYOUT_MANAGER_H_
#include "ash/shell_window_ids.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
......@@ -34,6 +33,18 @@ class RootWindowLayoutManager : public aura::LayoutManager {
explicit RootWindowLayoutManager(aura::Window* owner);
virtual ~RootWindowLayoutManager();
views::Widget* background_widget() { return background_widget_; }
ui::Layer* background_layer() { return background_layer_.get(); }
// Sets the background to |widget|. Closes and destroys the old widget if it
// exists and differs from the new widget.
void SetBackgroundWidget(views::Widget* widget);
// Sets a background layer, taking ownership of |layer|. This is provided as
// a lightweight alternative to SetBackgroundWidget(); layers can be simple
// colored quads instead of being textured.
void SetBackgroundLayer(ui::Layer* layer);
// Overridden from aura::LayoutManager:
virtual void OnWindowResized() OVERRIDE;
virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
......@@ -47,6 +58,10 @@ class RootWindowLayoutManager : public aura::LayoutManager {
private:
aura::Window* owner_;
// May be NULL if we're not painting a background.
views::Widget* background_widget_;
scoped_ptr<ui::Layer> background_layer_;
DISALLOW_COPY_AND_ASSIGN(RootWindowLayoutManager);
};
......
......@@ -7,8 +7,6 @@
#include "ash/shell.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/window_animations.h"
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
#include "ui/aura/root_window.h"
#include "ui/aura/window.h"
......@@ -44,8 +42,6 @@ void LockWindowAura::Init() {
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.show_state = ui::SHOW_STATE_FULLSCREEN;
if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableNewOobe))
params.transparent = true;
// TODO(oshima): move the lock screen harness to ash.
params.parent =
ash::Shell::GetContainer(
......
......@@ -7,8 +7,6 @@
#include <string>
#include <vector>
#include "ash/desktop_background/desktop_background_controller.h"
#include "ash/shell.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/lazy_instance.h"
......@@ -145,8 +143,6 @@ ScreenLocker::ScreenLocker(const User& user)
void ScreenLocker::Init() {
authenticator_ = LoginUtils::Get()->CreateAuthenticator(this);
delegate_.reset(new WebUIScreenLocker(this));
ash::Shell::GetInstance()->
desktop_background_controller()->MoveDesktopToLockedContainer();
delegate_->LockScreen(unlock_on_input_);
}
......@@ -322,8 +318,6 @@ void ScreenLocker::InitClass() {
ScreenLocker::~ScreenLocker() {
DCHECK(MessageLoop::current()->type() == MessageLoop::TYPE_UI);
ClearErrors();
ash::Shell::GetInstance()->
desktop_background_controller()->MoveDesktopToUnlockedContainer();
screen_locker_ = NULL;
bool state = false;
......
......@@ -203,7 +203,9 @@ void WebUILoginView::LoadURL(const GURL & url) {
webui_login_->RequestFocus();
CommandLine* command_line = CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kDisableNewOobe)) {
// Only enable transparency on sign in screen, not on lock screen.
if (BaseLoginDisplayHost::default_host() &&
!command_line->HasSwitch(switches::kDisableNewOobe)) {
// TODO(nkostylev): Use WebContentsObserver::RenderViewCreated to track
// when RenderView is created.
// Use a background with transparency to trigger transparency in Webkit.
......
......@@ -28,7 +28,7 @@ html[oobe=new]:not([screen=lock]) body {
}
html[oobe=new][screen=lock] body {
background-color: transparent;
-webkit-background-size: 100% 100%;
}
progress {
......
......@@ -170,8 +170,6 @@ cr.define('login', function() {
* Sets wallpaper for lock screen.
*/
AccountPickerScreen.setWallpaper = function() {
// TODO(antrim): remove whole method once 136853 is accepted.
return;
var oobe = Oobe.getInstance();
if (!oobe.isNewOobe() || !oobe.isLockScreen())
return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment