Commit 5de3b08e authored by oshima@chromium.org's avatar oshima@chromium.org

Remove unused ColoredWindowController/DesktopBackgroundFadeController

BUG=none
TBR=antrim@chromium.org

Review URL: https://codereview.chromium.org/99783005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238353 0039d316-1c4b-4281-b951-d872f2087c98
parent ac133468
...@@ -568,10 +568,6 @@ ...@@ -568,10 +568,6 @@
'wm/wm_types.h', 'wm/wm_types.h',
'wm/workspace_controller.cc', 'wm/workspace_controller.cc',
'wm/workspace_controller.h', 'wm/workspace_controller.h',
'wm/workspace/colored_window_controller.cc',
'wm/workspace/colored_window_controller.h',
'wm/workspace/desktop_background_fade_controller.cc',
'wm/workspace/desktop_background_fade_controller.h',
'wm/workspace/magnetism_matcher.cc', 'wm/workspace/magnetism_matcher.cc',
'wm/workspace/magnetism_matcher.h', 'wm/workspace/magnetism_matcher.h',
'wm/workspace/multi_window_resize_controller.cc', 'wm/workspace/multi_window_resize_controller.cc',
......
...@@ -613,22 +613,5 @@ void SessionStateAnimator::RunAnimationForWindow( ...@@ -613,22 +613,5 @@ void SessionStateAnimator::RunAnimationForWindow(
} }
} }
void SessionStateAnimator::CreateForeground() {
if (foreground_)
return;
aura::Window* window = Shell::GetContainer(
Shell::GetPrimaryRootWindow(),
internal::kShellWindowId_PowerButtonAnimationContainer);
HideWindowImmediately(window, NULL);
foreground_.reset(
new ColoredWindowController(window, "SessionStateAnimatorForeground"));
foreground_->SetColor(SK_ColorWHITE);
foreground_->GetWidget()->Show();
}
void SessionStateAnimator::DropForeground() {
foreground_.reset();
}
} // namespace internal } // namespace internal
} // namespace ash } // namespace ash
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define ASH_WM_SESSION_STATE_ANIMATOR_H_ #define ASH_WM_SESSION_STATE_ANIMATOR_H_
#include "ash/ash_export.h" #include "ash/ash_export.h"
#include "ash/wm/workspace/colored_window_controller.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
...@@ -140,12 +139,6 @@ class ASH_EXPORT SessionStateAnimator { ...@@ -140,12 +139,6 @@ class ASH_EXPORT SessionStateAnimator {
static void GetContainers(int container_mask, static void GetContainers(int container_mask,
aura::Window::Windows* containers); aura::Window::Windows* containers);
// Create |foreground_| layer if it doesn't already exist, but makes it
// completely transparent.
void CreateForeground();
// Destroy |foreground_| when it is not needed anymore.
void DropForeground();
// Apply animation |type| to all containers included in |container_mask| with // Apply animation |type| to all containers included in |container_mask| with
// specified |speed|. // specified |speed|.
void StartAnimation(int container_mask, void StartAnimation(int container_mask,
...@@ -178,10 +171,6 @@ class ASH_EXPORT SessionStateAnimator { ...@@ -178,10 +171,6 @@ class ASH_EXPORT SessionStateAnimator {
AnimationSpeed speed, AnimationSpeed speed,
ui::LayerAnimationObserver* observer); ui::LayerAnimationObserver* observer);
// White foreground that is used during shutdown animation to "fade
// everything into white".
scoped_ptr<ColoredWindowController> foreground_;
DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator); DISALLOW_COPY_AND_ASSIGN(SessionStateAnimator);
}; };
......
// 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/wm/workspace/colored_window_controller.h"
#include "ash/shell_window_ids.h"
#include "ash/wm/window_state.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/root_window.h"
#include "ui/gfx/canvas.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
namespace ash {
namespace internal {
// View implementation responsible for rendering the background.
class ColoredWindowController::View : public views::WidgetDelegateView {
public:
explicit View(ColoredWindowController* controller);
virtual ~View();
// Closes the hosting widget.
void Close();
// WidgetDelegate overrides:
virtual views::View* GetContentsView() OVERRIDE;
private:
ColoredWindowController* controller_;
DISALLOW_COPY_AND_ASSIGN(View);
};
ColoredWindowController::View::View(ColoredWindowController* controller)
: controller_(controller) {
}
ColoredWindowController::View::~View() {
if (controller_)
controller_->view_ = NULL;
}
void ColoredWindowController::View::Close() {
controller_ = NULL;
GetWidget()->Close();
}
views::View* ColoredWindowController::View::GetContentsView() {
return this;
}
ColoredWindowController::ColoredWindowController(aura::Window* parent,
const std::string& window_name)
: view_(new View(this)) {
views::Widget* widget = new views::Widget;
views::Widget::InitParams params(
views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
params.delegate = view_;
params.parent = parent;
params.can_activate = false;
params.accept_events = false;
params.layer_type = ui::LAYER_SOLID_COLOR;
widget->Init(params);
// Do this so the parent doesn't attempt to enforce any bounds constraints on
// us.
wm::GetWindowState(widget->GetNativeView())->SetTrackedByWorkspace(false);
widget->GetNativeView()->SetProperty(aura::client::kAnimationsDisabledKey,
true);
widget->GetNativeView()->SetName(window_name);
// The bounds should match the parent exactly. We don't go through
// Widget::SetBounds() as that may try to place on a different display.
widget->GetNativeWindow()->SetBounds(gfx::Rect(parent->bounds()));
}
ColoredWindowController::~ColoredWindowController() {
if (view_)
view_->Close();
}
void ColoredWindowController::SetColor(SkColor color) {
if (view_)
view_->GetWidget()->GetNativeView()->layer()->SetColor(color);
}
views::Widget* ColoredWindowController::GetWidget() {
return view_ ? view_->GetWidget() : NULL;
}
} // 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_WM_WORKSPACE_COLORED_WINDOW_CONTROLLER_H_
#define ASH_WM_WORKSPACE_COLORED_WINDOW_CONTROLLER_H_
#include <string>
#include "ash/ash_export.h"
#include "base/basictypes.h"
typedef unsigned int SkColor;
namespace aura {
class Window;
}
namespace views {
class Widget;
}
namespace ash {
namespace internal {
// ColoredWindowController creates a Widget whose layer is LAYER_SOLID_COLOR.
// The Widget is sized to the supplied Window and parented to the specified
// Window. It is used for animations.
class ASH_EXPORT ColoredWindowController {
public:
ColoredWindowController(aura::Window* parent, const std::string& window_name);
~ColoredWindowController();
// Changes the background color.
void SetColor(SkColor color);
views::Widget* GetWidget();
private:
class View;
// View responsible for rendering the background. This is non-NULL if the
// widget containing it is deleted. It is owned by the widget.
View* view_;
DISALLOW_COPY_AND_ASSIGN(ColoredWindowController);
};
} // namespace internal
} // namespace ash
#endif // ASH_WM_WORKSPACE_COLORED_WINDOW_CONTROLLER_H_
// 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/wm/workspace/desktop_background_fade_controller.h"
#include "ash/wm/window_animations.h"
#include "ash/wm/workspace/colored_window_controller.h"
#include "base/time/time.h"
#include "ui/aura/window.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/views/widget/widget.h"
namespace ash {
namespace internal {
DesktopBackgroundFadeController::DesktopBackgroundFadeController(
aura::Window* parent,
aura::Window* position_above,
base::TimeDelta duration,
Direction direction) {
SkColor start_color, target_color;
gfx::Tween::Type tween_type;
if (direction == FADE_OUT) {
start_color = SkColorSetARGB(0, 0, 0, 0);
target_color = SK_ColorBLACK;
tween_type = gfx::Tween::EASE_IN_OUT;
} else {
start_color = SK_ColorBLACK;
target_color = SkColorSetARGB(0, 0, 0, 0);
tween_type = gfx::Tween::EASE_IN_OUT;
}
window_controller_.reset(
new ColoredWindowController(parent, "DesktopFade"));
// Force the window to be directly on top of the desktop.
aura::Window* fade_window = window_controller_->GetWidget()->GetNativeView();
parent->StackChildBelow(fade_window, position_above);
parent->StackChildAbove(fade_window, position_above);
window_controller_->SetColor(start_color);
views::corewm::SetWindowVisibilityAnimationTransition(
window_controller_->GetWidget()->GetNativeView(),
views::corewm::ANIMATE_NONE);
window_controller_->GetWidget()->Show();
{
ui::ScopedLayerAnimationSettings scoped_setter(
fade_window->layer()->GetAnimator());
scoped_setter.AddObserver(this);
scoped_setter.SetTweenType(tween_type);
scoped_setter.SetTransitionDuration(duration);
window_controller_->SetColor(target_color);
}
}
DesktopBackgroundFadeController::~DesktopBackgroundFadeController() {
StopObservingImplicitAnimations();
}
void DesktopBackgroundFadeController::OnImplicitAnimationsCompleted() {
window_controller_.reset();
}
} // 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_WM_WORKSPACE_DESKTOP_BACKGROUND_FADE_CONTROLLER_H_
#define ASH_WM_WORKSPACE_DESKTOP_BACKGROUND_FADE_CONTROLLER_H_
#include "ash/ash_export.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "ui/compositor/layer_animation_observer.h"
namespace aura {
class Window;
}
namespace base {
class TimeDelta;
}
namespace ash {
namespace internal {
class ColoredWindowController;
// DesktopBackgroundFadeController handles fading in or out the desktop. It is
// used when maximizing or restoring a window. It is implemented as a colored
// layer whose opacity varies. This results in fading in or out all the windows
// the DesktopBackgroundFadeController is placed on top of. This is used
// instead of varying the opacity for two reasons:
// . The window showing background and the desktop workspace do not have a
// common parent that can be animated. This could be fixed, but wouldn't
// address the following.
// . When restoring the window is moved back to the desktop workspace. If we
// animated the opacity of the desktop workspace the cross fade would be
// effected.
class ASH_EXPORT DesktopBackgroundFadeController
: public ui::ImplicitAnimationObserver {
public:
// Direction to fade.
enum Direction {
FADE_IN,
FADE_OUT,
};
// Creates a new DesktopBackgroundFadeController. |parent| is the Window to
// parent the newly created window to. The newly created window is stacked
// directly on top of |position_above|. The window animating the fade is
// destroyed as soon as the animation completes.
DesktopBackgroundFadeController(aura::Window* parent,
aura::Window* position_above,
base::TimeDelta duration,
Direction direction);
virtual ~DesktopBackgroundFadeController();
private:
// ImplicitAnimationObserver overrides:
virtual void OnImplicitAnimationsCompleted() OVERRIDE;
scoped_ptr<ColoredWindowController> window_controller_;
DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundFadeController);
};
} // namespace internal
} // namespace ash
#endif // ASH_WM_WORKSPACE_DESKTOP_BACKGROUND_FADE_CONTROLLER_H_
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