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

Unified Diff: ash/mus/shadow.cc

Issue 2539363005: Converts ash to use aura-mus (Closed)
Patch Set: merge Created 4 years 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/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;
}

Powered by Google App Engine
This is Rietveld 408576698