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

Unified Diff: ash/wm/shadow.h

Issue 9414028: Aura: New window shadows, desktop background debug toggle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/wm/shadow.h
diff --git a/ash/wm/shadow.h b/ash/wm/shadow.h
index d16021f77881ef32e81e966515aba6ae0d0d7576..82226618ed38d6c9041c244843cbd0da457ace4c 100644
--- a/ash/wm/shadow.h
+++ b/ash/wm/shadow.h
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "ash/ash_export.h"
+#include "ui/gfx/compositor/layer_animation_observer.h"
#include "ui/gfx/rect.h"
namespace ui {
@@ -21,11 +22,21 @@ namespace internal {
class ImageGrid;
// Simple class that draws a drop shadow around content at given bounds.
-class ASH_EXPORT Shadow {
+class ASH_EXPORT Shadow : public ui::ImplicitAnimationObserver {
public:
+ enum Style {
+ // Active windows have more opaque shadows, shifted down to make the window
+ // appear "higher".
+ STYLE_ACTIVE,
+ // Inactive windows have less opaque shadows.
+ STYLE_INACTIVE,
+ };
+
Shadow();
~Shadow();
+ void Init();
+
// Returns |image_grid_|'s ui::Layer. This is exposed so it can be added to
// the same layer as the content and stacked below it. SetContentBounds()
// should be used to adjust the shadow's size and position (rather than
@@ -33,13 +44,28 @@ class ASH_EXPORT Shadow {
ui::Layer* layer() const;
const gfx::Rect& content_bounds() const { return content_bounds_; }
-
- void Init();
+ Style style() const { return style_; }
// Moves and resizes |image_grid_| to frame |content_bounds|.
void SetContentBounds(const gfx::Rect& content_bounds);
+ // Sets the shadow's style, animating opacity as necessary.
+ void SetStyle(Style style);
+
+ // ui::ImplicitAnimationObserver overrides:
+ virtual void OnImplicitAnimationsCompleted() OVERRIDE;
+
private:
+ // Updates the |image_grid_| images to the current |style_|.
+ void UpdateImagesForStyle();
+
+ // Updates the |image_grid_| bounds based on its image sizes and the
+ // current |content_bounds_|.
+ void UpdateImageGridBounds();
+
+ // The current style, set when the transition animation starts.
+ Style style_;
+
scoped_ptr<ImageGrid> image_grid_;
// Bounds of the content that the shadow encloses.
« no previous file with comments | « ash/wm/image_grid_unittest.cc ('k') | ash/wm/shadow.cc » ('j') | ash/wm/shadow.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698