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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #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
6 #define ASH_COMMON_WINDOW_DIMMER_H_
7
5 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/common/wm_window_observer.h"
6 #include "base/macros.h" 10 #include "base/macros.h"
7 #include "ui/aura/window.h"
8 #include "ui/aura/window_observer.h"
9 11
10 namespace ash { 12 namespace ash {
11 13
12 // A window used to dim the child windows of the given container. 14 // 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.
13 class ASH_EXPORT DimWindow : public aura::Window, public aura::WindowObserver { 15 // WindowDimmer, and the window it creates, are owned by the parent window of
16 // the WindowDimmer. You can trigger deletion explicitly by calling Destroy().
17 class ASH_EXPORT WindowDimmer : public WmWindowObserver {
14 public: 18 public:
15 // Return a dim window for the container if any, or nullptr. 19 // Return a dim window for the container if any, or nullptr.
16 static DimWindow* Get(aura::Window* container); 20 static WindowDimmer* Get(WmWindow* container);
17 21
18 explicit DimWindow(aura::Window* parent); 22 explicit WindowDimmer(WmWindow* parent);
19 ~DimWindow() override; 23
24 // Explicitly deletes a WindowDimmer.
25 void Destroy();
20 26
21 void SetDimOpacity(float target_opacity); 27 void SetDimOpacity(float target_opacity);
22 28
23 // aura::WindowObserver: 29 WmWindow* parent() { return parent_; }
24 void OnWindowBoundsChanged(aura::Window* window, 30 WmWindow* window() { return window_; }
31
32 // WmWindowObserver:
33 void OnWindowBoundsChanged(WmWindow* window,
25 const gfx::Rect& old_bounds, 34 const gfx::Rect& old_bounds,
26 const gfx::Rect& new_bounds) override; 35 const gfx::Rect& new_bounds) override;
27 void OnWindowDestroying(aura::Window* window) override;
28 36
29 private: 37 private:
30 aura::Window* parent_; 38 struct Data;
31 39
32 DISALLOW_COPY_AND_ASSIGN(DimWindow); 40 ~WindowDimmer() override;
41
42 WmWindow* parent_;
43 WmWindow* window_;
44
45 DISALLOW_COPY_AND_ASSIGN(WindowDimmer);
33 }; 46 };
34 47
35 } // namespace ash 48 } // namespace ash
49
50 #endif // ASH_COMMON_WINDOW_DIMMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698