Index: ash/mus/shadow.cc |
diff --git a/ash/mus/shadow.cc b/ash/mus/shadow.cc |
index 21be30480c71cf9125de82664655609976d31dbd..0f9cacb543f6d81387761f46a41b73b59ddac4e3 100644 |
--- a/ash/mus/shadow.cc |
+++ b/ash/mus/shadow.cc |
@@ -4,18 +4,22 @@ |
#include "ash/mus/shadow.h" |
-#include "ash/mus/property_util.h" |
#include "third_party/skia/include/core/SkBitmap.h" |
+#include "ui/aura/window.h" |
+#include "ui/aura/window_property.h" |
#include "ui/base/resource/resource_bundle.h" |
#include "ui/compositor/layer.h" |
#include "ui/compositor/scoped_layer_animation_settings.h" |
#include "ui/resources/grit/ui_resources.h" |
+DECLARE_WINDOW_PROPERTY_TYPE(ash::mus::Shadow*); |
+ |
namespace ash { |
namespace mus { |
- |
namespace { |
+DEFINE_WINDOW_PROPERTY_KEY(Shadow*, kShadowProperty, nullptr); |
+ |
// The opacity used for active shadow when animating between |
// inactive/active shadow. |
const float kInactiveShadowAnimationOpacity = 0.2f; |
@@ -57,7 +61,7 @@ Shadow::Shadow() : style_(STYLE_ACTIVE), interior_inset_(0), window_(nullptr) {} |
Shadow::~Shadow() { |
if (window_) { |
- SetShadow(window_, nullptr); |
+ window_->ClearProperty(kShadowProperty); |
window_->RemoveObserver(this); |
} |
} |
@@ -76,6 +80,11 @@ void Shadow::Init(Style style) { |
} |
// static |
+Shadow* Shadow::Get(aura::Window* window) { |
+ return window->GetProperty(kShadowProperty); |
+} |
+ |
+// static |
int Shadow::GetInteriorInsetForStyle(Shadow::Style style) { |
switch (style) { |
case Shadow::STYLE_ACTIVE: |
@@ -144,8 +153,8 @@ void Shadow::SetStyle(Style style) { |
} |
} |
-void Shadow::Install(ui::Window* window) { |
- SetShadow(window, this); |
+void Shadow::Install(aura::Window* window) { |
+ window->SetProperty(kShadowProperty, this); |
window_ = window; |
window_->AddObserver(this); |
} |
@@ -216,7 +225,7 @@ void Shadow::UpdateLayerBounds() { |
shadow_layer_->UpdateNinePatchOcclusion(content_bounds); |
} |
-void Shadow::OnWindowDestroyed(ui::Window* window) { |
+void Shadow::OnWindowDestroyed(aura::Window* window) { |
DCHECK_EQ(window_, window); |
window_ = nullptr; |
} |