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

Unified Diff: ash/common/wm/window_dimmer.cc

Issue 2699033002: Replace WmWindowObserver with aura::WindowObserver. (Closed)
Patch Set: Check for null images in ShelfWindowWatcher. Created 3 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
« no previous file with comments | « ash/common/wm/window_dimmer.h ('k') | ash/common/wm/window_positioning_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/window_dimmer.cc
diff --git a/ash/common/wm/window_dimmer.cc b/ash/common/wm/window_dimmer.cc
index bdd1109d9905c3b44ed9da1b3902386006559ade..c90d806832fe21d6b24aa82e6689315fee2209f6 100644
--- a/ash/common/wm/window_dimmer.cc
+++ b/ash/common/wm/window_dimmer.cc
@@ -9,6 +9,7 @@
#include "ash/common/wm_shell.h"
#include "ash/common/wm_window.h"
#include "base/time/time.h"
+#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
#include "ui/wm/core/window_animations.h"
@@ -30,12 +31,12 @@ WindowDimmer::WindowDimmer(WmWindow* parent)
::wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE);
window_->SetVisibilityAnimationDuration(
base::TimeDelta::FromMilliseconds(kDefaultDimAnimationDurationMs));
- window_->AddObserver(this);
+ window_->aura_window()->AddObserver(this);
SetDimOpacity(kDefaultDimOpacity);
parent->AddChild(window_);
- parent->AddObserver(this);
+ parent->aura_window()->AddObserver(this);
parent->StackChildAtTop(window_);
window_->SetBounds(gfx::Rect(parent_->GetBounds().size()));
@@ -43,9 +44,9 @@ WindowDimmer::WindowDimmer(WmWindow* parent)
WindowDimmer::~WindowDimmer() {
if (parent_)
- parent_->RemoveObserver(this);
+ parent_->aura_window()->RemoveObserver(this);
if (window_) {
- window_->RemoveObserver(this);
+ window_->aura_window()->RemoveObserver(this);
window_->Destroy();
}
}
@@ -56,27 +57,28 @@ void WindowDimmer::SetDimOpacity(float target_opacity) {
SkColorSetA(SK_ColorBLACK, 255 * target_opacity));
}
-void WindowDimmer::OnWindowBoundsChanged(WmWindow* window,
+void WindowDimmer::OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) {
- if (window == parent_)
+ if (WmWindow::Get(window) == parent_)
window_->SetBounds(gfx::Rect(new_bounds.size()));
}
-void WindowDimmer::OnWindowDestroying(WmWindow* window) {
- if (window == parent_) {
- parent_->RemoveObserver(this);
+void WindowDimmer::OnWindowDestroying(aura::Window* window) {
+ if (WmWindow::Get(window) == parent_) {
+ parent_->aura_window()->RemoveObserver(this);
parent_ = nullptr;
} else {
- DCHECK_EQ(window_, window);
- window_->RemoveObserver(this);
+ DCHECK_EQ(window_, WmWindow::Get(window));
+ window_->aura_window()->RemoveObserver(this);
window_ = nullptr;
}
}
-void WindowDimmer::OnWindowTreeChanging(WmWindow* window,
- const TreeChangeParams& params) {
- if (window == window_ && params.target == window) {
+void WindowDimmer::OnWindowHierarchyChanging(
+ const HierarchyChangeParams& params) {
+ if (WmWindow::Get(params.receiver) == window_ &&
+ 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();
« no previous file with comments | « ash/common/wm/window_dimmer.h ('k') | ash/common/wm/window_positioning_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698