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

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

Issue 2320273002: Refactors DimWindow and moves to ash/common (Closed)
Patch Set: git add wm_window Created 4 years, 3 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/common/wm/window_dimmer.h
diff --git a/ash/wm/dim_window.h b/ash/common/wm/window_dimmer.h
similarity index 37%
rename from ash/wm/dim_window.h
rename to ash/common/wm/window_dimmer.h
index 8d86c63d02dbeba44449d2a25a40698ce950a786..e20f9340809a3559db5190eae4c092c1751a7785 100644
--- a/ash/wm/dim_window.h
+++ b/ash/common/wm/window_dimmer.h
@@ -2,34 +2,49 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#ifndef ASH_COMMON_WINDOW_DIMMER_H_
James Cook 2016/09/09 00:03:35 Aside: I find it amusing how often we (I) forget h
+#define ASH_COMMON_WINDOW_DIMMER_H_
+
#include "ash/ash_export.h"
+#include "ash/common/wm_window_observer.h"
#include "base/macros.h"
-#include "ui/aura/window.h"
-#include "ui/aura/window_observer.h"
namespace ash {
-// A window used to dim the child windows of the given container.
-class ASH_EXPORT DimWindow : public aura::Window, public aura::WindowObserver {
+// WindowDimmer creates a window that is used to dim siblings of window.
James Cook 2016/09/09 00:03:35 nit: of a window
sky 2016/09/09 03:50:04 Done.
+// WindowDimmer, and the window it creates, are owned by the parent window of
+// the WindowDimmer. You can trigger deletion explicitly by calling Destroy().
+class ASH_EXPORT WindowDimmer : public WmWindowObserver {
public:
// Return a dim window for the container if any, or nullptr.
- static DimWindow* Get(aura::Window* container);
+ static WindowDimmer* Get(WmWindow* container);
+
+ explicit WindowDimmer(WmWindow* parent);
- explicit DimWindow(aura::Window* parent);
- ~DimWindow() override;
+ // Explicitly deletes a WindowDimmer.
+ void Destroy();
void SetDimOpacity(float target_opacity);
- // aura::WindowObserver:
- void OnWindowBoundsChanged(aura::Window* window,
+ WmWindow* parent() { return parent_; }
+ WmWindow* window() { return window_; }
+
+ // WmWindowObserver:
+ void OnWindowBoundsChanged(WmWindow* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) override;
- void OnWindowDestroying(aura::Window* window) override;
private:
- aura::Window* parent_;
+ struct Data;
- DISALLOW_COPY_AND_ASSIGN(DimWindow);
+ ~WindowDimmer() override;
+
+ WmWindow* parent_;
+ WmWindow* window_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowDimmer);
};
} // namespace ash
+
+#endif // ASH_COMMON_WINDOW_DIMMER_H_

Powered by Google App Engine
This is Rietveld 408576698