0

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.

Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=149869

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@150271 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
antrim@chromium.org
2012-08-07 04:17:32 +00:00
parent 140860caeb
commit b4ddc7a093
17 changed files with 353 additions and 124 deletions

@ -63,6 +63,8 @@
'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,6 +5,7 @@
#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"
@ -18,6 +19,7 @@
#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"
@ -99,9 +101,11 @@ class DesktopBackgroundController::WallpaperOperation
};
DesktopBackgroundController::DesktopBackgroundController()
: desktop_background_mode_(BACKGROUND_IMAGE),
: locked_(false),
desktop_background_mode_(BACKGROUND_SOLID_COLOR),
background_color_(SK_ColorGRAY),
weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
InstallComponentForAllWindows();
}
DesktopBackgroundController::~DesktopBackgroundController() {
@ -128,38 +132,32 @@ SkBitmap DesktopBackgroundController::GetCurrentWallpaperImage() {
void DesktopBackgroundController::OnRootWindowAdded(
aura::RootWindow* root_window) {
switch (desktop_background_mode_) {
case BACKGROUND_IMAGE:
if (current_wallpaper_.get()) {
gfx::Size root_window_size = root_window->GetHostSize();
int wallpaper_width = current_wallpaper_->wallpaper_image.width();
int wallpaper_height = current_wallpaper_->wallpaper_image.height();
// Loads a higher resolution wallpaper if needed.
if ((wallpaper_width < root_window_size.width() ||
wallpaper_height < root_window_size.height()) &&
current_wallpaper_->wallpaper_index != -1 &&
current_wallpaper_->wallpaper_layout != TILE)
SetDefaultWallpaper(current_wallpaper_->wallpaper_index, true);
else
SetDesktopBackgroundImage(root_window);
} else {
internal::CreateDesktopBackground(root_window);
}
break;
case BACKGROUND_SOLID_COLOR:
SetDesktopBackgroundSolidColorMode(background_color_);
break;
// Handle resolution change for "built-in" images."
if (BACKGROUND_IMAGE == desktop_background_mode_) {
if (current_wallpaper_.get()) {
gfx::Size root_window_size = root_window->GetHostSize();
int wallpaper_width = current_wallpaper_->wallpaper_image.width();
int wallpaper_height = current_wallpaper_->wallpaper_image.height();
// Loads a higher resolution wallpaper if needed.
if ((wallpaper_width < root_window_size.width() ||
wallpaper_height < root_window_size.height()) &&
current_wallpaper_->wallpaper_index != -1 &&
current_wallpaper_->wallpaper_layout != TILE)
SetDefaultWallpaper(current_wallpaper_->wallpaper_index, true);
}
}
InstallComponent(root_window);
}
void DesktopBackgroundController::SetDefaultWallpaper(int index,
bool force_reload) {
// We should not change background when index is invalid. For instance, at
// login screen or stub_user login.
if (index == ash::GetInvalidWallpaperIndex()) {
if (index == GetInvalidWallpaperIndex()) {
CreateEmptyWallpaper();
return;
} else if (index == ash::GetSolidColorIndex()) {
} else if (index == GetSolidColorIndex()) {
SetDesktopBackgroundSolidColorMode(kLoginWallpaperColor);
return;
}
@ -195,8 +193,7 @@ void DesktopBackgroundController::SetCustomWallpaper(
WallpaperLayout layout) {
CancelPendingWallpaperOperation();
current_wallpaper_.reset(new WallpaperData(layout, wallpaper));
desktop_background_mode_ = BACKGROUND_IMAGE;
UpdateDesktopBackgroundImageMode();
SetDesktopBackgroundImageMode();
}
void DesktopBackgroundController::CancelPendingWallpaperOperation() {
@ -210,65 +207,151 @@ 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;
desktop_background_mode_ = BACKGROUND_SOLID_COLOR;
if (desktop_background_mode_ != BACKGROUND_SOLID_COLOR) {
desktop_background_mode_ = BACKGROUND_SOLID_COLOR;
InstallComponentForAllWindows();
return;
}
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;
Shell::GetContainer(
root_window,
internal::kShellWindowId_DesktopBackgroundContainer)->
layer()->Add(background_layer);
GetRootWindowLayoutManager(root_window)->SetBackgroundLayer(
background_layer);
GetRootWindowLayoutManager(root_window)->SetBackgroundWidget(NULL);
internal::DesktopBackgroundWidgetController* component = root_window->
GetProperty(internal::kWindowDesktopComponent);
DCHECK(component);
DCHECK(component->layer());
component->layer()->SetColor(background_color_ );
}
}
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::CreateEmptyWallpaper() {
current_wallpaper_.reset(NULL);
SetDesktopBackgroundImageMode();
}
void DesktopBackgroundController::UpdateDesktopBackgroundImageMode() {
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::OnWindowDestroying(aura::Window* window) {
window->SetProperty(internal::kWindowDesktopComponent,
static_cast<internal::DesktopBackgroundWidgetController*>(NULL));
}
void DesktopBackgroundController::SetDesktopBackgroundImageMode() {
if (desktop_background_mode_ != BACKGROUND_IMAGE) {
desktop_background_mode_ = BACKGROUND_IMAGE;
InstallComponentForAllWindows();
return;
}
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
for (Shell::RootWindowList::iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
SetDesktopBackgroundImage(*iter);
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()));
}
desktop_background_mode_ = BACKGROUND_IMAGE;
}
void DesktopBackgroundController::OnWallpaperLoadCompleted(
scoped_refptr<WallpaperOperation> wo) {
current_wallpaper_.reset(wo->ReleaseWallpaperData());
UpdateDesktopBackgroundImageMode();
SetDesktopBackgroundImageMode();
DCHECK(wo.get() == wallpaper_op_.get());
wallpaper_op_ = NULL;
}
void DesktopBackgroundController::CreateEmptyWallpaper() {
current_wallpaper_.reset(NULL);
desktop_background_mode_ = BACKGROUND_IMAGE;
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();
}
}
if (NULL == root_window->GetProperty(internal::kWindowDesktopComponent)) {
// First time for this root window
root_window->AddObserver(this);
}
root_window->SetProperty(internal::kWindowDesktopComponent, component);
}
void DesktopBackgroundController::InstallComponentForAllWindows() {
Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
for (Shell::RootWindowList::iterator iter = root_windows.begin();
iter != root_windows.end(); ++iter) {
internal::CreateDesktopBackground(*iter);
InstallComponent(*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,6 +13,9 @@
#include "base/memory/weak_ptr.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/image/image_skia.h"
namespace aura {
@ -47,7 +50,7 @@ class UserWallpaperDelegate {
// Loads selected desktop wallpaper from file system asynchronously and updates
// background layer if loaded successfully.
class ASH_EXPORT DesktopBackgroundController {
class ASH_EXPORT DesktopBackgroundController : public aura::WindowObserver {
public:
enum BackgroundMode {
BACKGROUND_IMAGE,
@ -99,25 +102,52 @@ 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();
// WindowObserver implementation.
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
private:
// An operation to asynchronously loads wallpaper.
class WallpaperOperation;
struct WallpaperData;
// 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 view for all root windows, or notifies them to repaint if they
// already exist.
void SetDesktopBackgroundImageMode();
// 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,7 +10,6 @@
#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"
@ -31,8 +30,10 @@ 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) {
}
@ -42,11 +43,6 @@ 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();
@ -54,6 +50,7 @@ class ShowWallpaperAnimationObserver : public ui::ImplicitAnimationObserver {
}
aura::RootWindow* root_window_;
int container_id_;
views::Widget* desktop_widget_;
DISALLOW_COPY_AND_ASSIGN(ShowWallpaperAnimationObserver);
@ -138,7 +135,8 @@ void DesktopBackgroundView::ShowContextMenuForView(views::View* source,
Shell::GetInstance()->ShowBackgroundMenu(GetWidget(), point);
}
void CreateDesktopBackground(aura::RootWindow* root_window) {
views::Widget* CreateDesktopBackground(aura::RootWindow* root_window,
int container_id) {
DesktopBackgroundController* controller = ash::Shell::GetInstance()->
desktop_background_controller();
views::Widget* desktop_widget = new views::Widget;
@ -148,8 +146,7 @@ void CreateDesktopBackground(aura::RootWindow* root_window) {
params.delegate = view;
if (controller->GetWallpaper().empty())
params.transparent = true;
params.parent = root_window->GetChildById(
ash::internal::kShellWindowId_DesktopBackgroundContainer);
params.parent = root_window->GetChildById(container_id);
desktop_widget->Init(params);
desktop_widget->SetContentsView(view);
ash::WindowVisibilityAnimationType animation_type =
@ -163,9 +160,11 @@ void 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

@ -0,0 +1,57 @@
// 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

@ -0,0 +1,54 @@
// 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,6 +6,7 @@
#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"
@ -168,6 +169,13 @@ 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(
@ -277,7 +285,9 @@ void RootWindowController::CreateContainers() {
void RootWindowController::CloseChildWindows() {
// Close background widget first as it depends on tooltip.
root_window_layout_->SetBackgroundWidget(NULL);
root_window_->SetProperty(kWindowDesktopComponent,
static_cast<DesktopBackgroundWidgetController*>(NULL));
workspace_controller_.reset();
aura::client::SetTooltipClient(root_window_.get(), NULL);

@ -30,7 +30,8 @@ class Widget;
namespace ash {
namespace internal {
void CreateDesktopBackground(aura::RootWindow* root_window);
views::Widget* CreateDesktopBackground(aura::RootWindow* root_window,
int container_id);
ASH_EXPORT views::Widget* CreateStatusArea(views::View* contents);

@ -3,6 +3,7 @@
// 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"
@ -57,6 +58,8 @@ 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(
@ -271,8 +274,13 @@ 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.
EXPECT_TRUE(test_api.root_window_layout()->background_widget());
EXPECT_FALSE(test_api.root_window_layout()->background_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());
// Create a normal window. It is not maximized.
views::Widget::InitParams widget_params(

@ -57,28 +57,31 @@ 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 = 12;
const int kShellWindowId_LockScreenContainer = 13;
// The container for the lock screen modal windows.
const int kShellWindowId_LockSystemModalContainer = 13;
const int kShellWindowId_LockSystemModalContainer = 14;
// The container for the status area.
const int kShellWindowId_StatusContainer = 14;
const int kShellWindowId_StatusContainer = 15;
// The container for menus.
const int kShellWindowId_MenuContainer = 15;
const int kShellWindowId_MenuContainer = 16;
// The container for drag/drop images and tooltips.
const int kShellWindowId_DragImageAndTooltipContainer = 16;
const int kShellWindowId_DragImageAndTooltipContainer = 17;
// The container for bubbles briefly overlaid onscreen to show settings changes
// (volume, brightness, etc.).
const int kShellWindowId_SettingBubbleContainer = 17;
const int kShellWindowId_SettingBubbleContainer = 18;
// The container for special components overlaid onscreen, such as the
// region selector for partial screenshots.
const int kShellWindowId_OverlayContainer = 18;
const int kShellWindowId_OverlayContainer = 19;
} // namespace internal

@ -4,6 +4,7 @@
#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"
@ -15,25 +16,12 @@ namespace internal {
// RootWindowLayoutManager, public:
RootWindowLayoutManager::RootWindowLayoutManager(aura::Window* owner)
: owner_(owner),
background_widget_(NULL) {
: owner_(owner) {
}
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:
@ -51,11 +39,10 @@ void RootWindowLayoutManager::OnWindowResized() {
for (j = (*i)->children().begin(); j != (*i)->children().end(); ++j)
(*j)->SetBounds(fullscreen_bounds);
}
if (background_widget_)
background_widget_->SetBounds(fullscreen_bounds);
if (background_layer_.get())
background_layer_->SetBounds(fullscreen_bounds);
internal::DesktopBackgroundWidgetController* background =
owner_->GetProperty(internal::kWindowDesktopComponent);
if (background)
background->SetBounds(fullscreen_bounds);
}
void RootWindowLayoutManager::OnWindowAddedToLayout(aura::Window* child) {

@ -5,6 +5,7 @@
#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"
@ -33,18 +34,6 @@ 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;
@ -58,10 +47,6 @@ 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,6 +7,8 @@
#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"
@ -42,6 +44,8 @@ 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,6 +7,8 @@
#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"
@ -143,6 +145,8 @@ 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_);
}
@ -318,6 +322,8 @@ 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,9 +203,7 @@ void WebUILoginView::LoadURL(const GURL & url) {
webui_login_->RequestFocus();
CommandLine* command_line = CommandLine::ForCurrentProcess();
// Only enable transparency on sign in screen, not on lock screen.
if (BaseLoginDisplayHost::default_host() &&
!command_line->HasSwitch(switches::kDisableNewOobe)) {
if (!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 {
-webkit-background-size: 100% 100%;
background-color: transparent;
}
progress {

@ -170,6 +170,8 @@ 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;