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

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

Issue 2734653002: chromeos: Move files in //ash/common to //ash (Closed)
Patch Set: fix a11y tests, fix docs 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
« no previous file with comments | « ash/common/wm/root_window_layout_manager.cc ('k') | ash/common/wm/screen_dimmer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_COMMON_WM_SCREEN_DIMMER_H_
6 #define ASH_COMMON_WM_SCREEN_DIMMER_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "ash/ash_export.h"
12 #include "ash/common/shell_observer.h"
13 #include "base/macros.h"
14
15 namespace ash {
16 namespace test {
17 class ScreenDimmerTest;
18 }
19
20 class WindowDimmer;
21
22 template <typename UserData>
23 class WmWindowUserData;
24
25 // ScreenDimmer displays a partially-opaque layer above everything
26 // else in the given container window to darken the display. It shouldn't be
27 // used for long-term brightness adjustments due to performance
28 // 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
30 // about to suspend a machine that lacks an internal backlight that
31 // can be adjusted).
32 class ASH_EXPORT ScreenDimmer : public ShellObserver {
33 public:
34 // Indicates the container ScreenDimmer operates on.
35 enum class Container {
36 ROOT,
37 LOCK_SCREEN,
38 };
39
40 explicit ScreenDimmer(Container container);
41 ~ScreenDimmer() override;
42
43 // Dim or undim the layers.
44 void SetDimming(bool should_dim);
45
46 void set_at_bottom(bool at_bottom) { at_bottom_ = at_bottom; }
47
48 bool is_dimming() const { return is_dimming_; }
49
50 // Find a ScreenDimmer in the container, or nullptr if it does not exist.
51 static ScreenDimmer* FindForTest(int container_id);
52
53 private:
54 friend class test::ScreenDimmerTest;
55
56 // Returns the WmWindows (one per display) that correspond to |container_|.
57 std::vector<WmWindow*> GetAllContainers();
58
59 // ShellObserver:
60 void OnRootWindowAdded(WmWindow* root_window) override;
61
62 // Update the dimming state. This will also create a new DimWindow
63 // if necessary. (Used when a new display is connected)
64 void Update(bool should_dim);
65
66 const Container container_;
67
68 // Are we currently dimming the screen?
69 bool is_dimming_;
70 bool at_bottom_;
71
72 // Owns the WindowDimmers.
73 std::unique_ptr<WmWindowUserData<WindowDimmer>> window_dimmers_;
74
75 DISALLOW_COPY_AND_ASSIGN(ScreenDimmer);
76 };
77
78 } // namespace ash
79
80 #endif // ASH_COMMON_WM_SCREEN_DIMMER_H_
OLDNEW
« no previous file with comments | « ash/common/wm/root_window_layout_manager.cc ('k') | ash/common/wm/screen_dimmer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698