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

Side by Side Diff: ash/common/wm/screen_dimmer.h

Issue 2735983006: Renames WmWindowUserData and converts to using aura (Closed)
Patch Set: ownership comments Created 3 years, 9 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_WM_SCREEN_DIMMER_H_ 5 #ifndef ASH_COMMON_WM_SCREEN_DIMMER_H_
6 #define ASH_COMMON_WM_SCREEN_DIMMER_H_ 6 #define ASH_COMMON_WM_SCREEN_DIMMER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
11 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
12 #include "ash/common/shell_observer.h" 12 #include "ash/common/shell_observer.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 14
15 namespace aura {
16 class Window;
17 }
18
15 namespace ash { 19 namespace ash {
20
21 class WindowDimmer;
22
23 template <typename UserData>
24 class WindowUserData;
25
16 namespace test { 26 namespace test {
17 class ScreenDimmerTest; 27 class ScreenDimmerTest;
18 } 28 }
19 29
20 class WindowDimmer;
21
22 template <typename UserData>
23 class WmWindowUserData;
24
25 // ScreenDimmer displays a partially-opaque layer above everything 30 // ScreenDimmer displays a partially-opaque layer above everything
26 // else in the given container window to darken the display. It shouldn't be 31 // else in the given container window to darken the display. It shouldn't be
27 // used for long-term brightness adjustments due to performance 32 // used for long-term brightness adjustments due to performance
28 // considerations -- it's only intended for cases where we want to 33 // considerations -- it's only intended for cases where we want to
29 // briefly dim the screen (e.g. to indicate to the user that we're 34 // briefly dim the screen (e.g. to indicate to the user that we're
30 // about to suspend a machine that lacks an internal backlight that 35 // about to suspend a machine that lacks an internal backlight that
31 // can be adjusted). 36 // can be adjusted).
32 class ASH_EXPORT ScreenDimmer : public ShellObserver { 37 class ASH_EXPORT ScreenDimmer : public ShellObserver {
33 public: 38 public:
34 // Indicates the container ScreenDimmer operates on. 39 // Indicates the container ScreenDimmer operates on.
(...skipping 11 matching lines...) Expand all
46 void set_at_bottom(bool at_bottom) { at_bottom_ = at_bottom; } 51 void set_at_bottom(bool at_bottom) { at_bottom_ = at_bottom; }
47 52
48 bool is_dimming() const { return is_dimming_; } 53 bool is_dimming() const { return is_dimming_; }
49 54
50 // Find a ScreenDimmer in the container, or nullptr if it does not exist. 55 // Find a ScreenDimmer in the container, or nullptr if it does not exist.
51 static ScreenDimmer* FindForTest(int container_id); 56 static ScreenDimmer* FindForTest(int container_id);
52 57
53 private: 58 private:
54 friend class test::ScreenDimmerTest; 59 friend class test::ScreenDimmerTest;
55 60
56 // Returns the WmWindows (one per display) that correspond to |container_|. 61 // Returns the aura::Windows (one per display) that correspond to
57 std::vector<WmWindow*> GetAllContainers(); 62 // |container_|.
63 std::vector<aura::Window*> GetAllContainers();
58 64
59 // ShellObserver: 65 // ShellObserver:
60 void OnRootWindowAdded(WmWindow* root_window) override; 66 void OnRootWindowAdded(WmWindow* root_window) override;
61 67
62 // Update the dimming state. This will also create a new DimWindow 68 // Update the dimming state. This will also create a new DimWindow
63 // if necessary. (Used when a new display is connected) 69 // if necessary. (Used when a new display is connected)
64 void Update(bool should_dim); 70 void Update(bool should_dim);
65 71
66 const Container container_; 72 const Container container_;
67 73
68 // Are we currently dimming the screen? 74 // Are we currently dimming the screen?
69 bool is_dimming_; 75 bool is_dimming_;
70 bool at_bottom_; 76 bool at_bottom_;
71 77
72 // Owns the WindowDimmers. 78 // Owns the WindowDimmers.
73 std::unique_ptr<WmWindowUserData<WindowDimmer>> window_dimmers_; 79 std::unique_ptr<WindowUserData<WindowDimmer>> window_dimmers_;
74 80
75 DISALLOW_COPY_AND_ASSIGN(ScreenDimmer); 81 DISALLOW_COPY_AND_ASSIGN(ScreenDimmer);
76 }; 82 };
77 83
78 } // namespace ash 84 } // namespace ash
79 85
80 #endif // ASH_COMMON_WM_SCREEN_DIMMER_H_ 86 #endif // ASH_COMMON_WM_SCREEN_DIMMER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698