Index: ash/common/wm/window_dimmer.cc |
diff --git a/ash/common/wm/window_dimmer.cc b/ash/common/wm/window_dimmer.cc |
index c90d806832fe21d6b24aa82e6689315fee2209f6..5c6c5382bce73d1cbddfa462138d4f35e6a02670 100644 |
--- a/ash/common/wm/window_dimmer.cc |
+++ b/ash/common/wm/window_dimmer.cc |
@@ -11,6 +11,7 @@ |
#include "base/time/time.h" |
#include "ui/aura/window.h" |
#include "ui/compositor/layer.h" |
+#include "ui/wm/core/visibility_controller.h" |
#include "ui/wm/core/window_animations.h" |
namespace ash { |
@@ -22,63 +23,63 @@ const float kDefaultDimOpacity = 0.5f; |
} // namespace |
-WindowDimmer::WindowDimmer(WmWindow* parent) |
+WindowDimmer::WindowDimmer(aura::Window* parent) |
: parent_(parent), |
- window_(WmShell::Get()->NewWindow(ui::wm::WINDOW_TYPE_NORMAL, |
- ui::LAYER_SOLID_COLOR)) { |
- window_->SetVisibilityChangesAnimated(); |
- window_->SetVisibilityAnimationType( |
- ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
- window_->SetVisibilityAnimationDuration( |
+ window_(WmShell::Get() |
+ ->NewWindow(ui::wm::WINDOW_TYPE_NORMAL, ui::LAYER_SOLID_COLOR) |
sky
2017/03/09 01:02:25
NewWindow is being nuked in another patch cycling
|
+ ->aura_window()) { |
+ ::wm::SetWindowVisibilityChangesAnimated(window_.get()); |
+ ::wm::SetWindowVisibilityAnimationType( |
+ window_.get(), ::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
+ ::wm::SetWindowVisibilityAnimationDuration( |
+ window_.get(), |
base::TimeDelta::FromMilliseconds(kDefaultDimAnimationDurationMs)); |
- window_->aura_window()->AddObserver(this); |
+ window_->AddObserver(this); |
SetDimOpacity(kDefaultDimOpacity); |
- parent->AddChild(window_); |
- parent->aura_window()->AddObserver(this); |
- parent->StackChildAtTop(window_); |
+ parent->AddChild(window_.get()); |
+ parent->AddObserver(this); |
+ parent->StackChildAtTop(window_.get()); |
- window_->SetBounds(gfx::Rect(parent_->GetBounds().size())); |
+ window_->SetBounds(gfx::Rect(parent_->bounds().size())); |
} |
WindowDimmer::~WindowDimmer() { |
if (parent_) |
- parent_->aura_window()->RemoveObserver(this); |
+ parent_->RemoveObserver(this); |
if (window_) { |
- window_->aura_window()->RemoveObserver(this); |
- window_->Destroy(); |
+ window_->RemoveObserver(this); |
+ window_.reset(); |
} |
} |
void WindowDimmer::SetDimOpacity(float target_opacity) { |
DCHECK(window_); |
- window_->GetLayer()->SetColor( |
- SkColorSetA(SK_ColorBLACK, 255 * target_opacity)); |
+ window_->layer()->SetColor(SkColorSetA(SK_ColorBLACK, 255 * target_opacity)); |
} |
void WindowDimmer::OnWindowBoundsChanged(aura::Window* window, |
const gfx::Rect& old_bounds, |
const gfx::Rect& new_bounds) { |
- if (WmWindow::Get(window) == parent_) |
+ if (window == parent_) |
window_->SetBounds(gfx::Rect(new_bounds.size())); |
} |
void WindowDimmer::OnWindowDestroying(aura::Window* window) { |
- if (WmWindow::Get(window) == parent_) { |
- parent_->aura_window()->RemoveObserver(this); |
+ if (window == parent_) { |
+ parent_->RemoveObserver(this); |
parent_ = nullptr; |
} else { |
- DCHECK_EQ(window_, WmWindow::Get(window)); |
- window_->aura_window()->RemoveObserver(this); |
- window_ = nullptr; |
+ DCHECK_EQ(window_.get(), window); |
+ window_->RemoveObserver(this); |
+ window_.release(); |
} |
} |
void WindowDimmer::OnWindowHierarchyChanging( |
const HierarchyChangeParams& params) { |
- if (WmWindow::Get(params.receiver) == window_ && |
- params.target == params.receiver) { |
+ if (params.receiver == window_.get() && params.target == params.receiver) { |
// This may happen on a display change or some unexpected condition. Hide |
// the window to ensure it isn't obscuring the wrong thing. |
window_->Hide(); |