Disable overview mode by default.
[chromium-blink-merge.git] / ash / wm / screen_dimmer.h
blob476c27449a30e059d043e73a6540ed7f4369414e
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.
5 #ifndef ASH_WM_SCREEN_DIMMER_H_
6 #define ASH_WM_SCREEN_DIMMER_H_
8 #include "ash/ash_export.h"
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/aura/window_observer.h"
14 namespace aura {
15 class RootWindow;
18 namespace ui {
19 class Layer;
22 namespace ash {
23 namespace internal {
25 // ScreenDimmer displays a partially-opaque layer above everything
26 // else in the root window to darken the display. It shouldn't be used
27 // 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 aura::WindowObserver {
33 public:
34 class TestApi {
35 public:
36 explicit TestApi(ScreenDimmer* dimmer) : dimmer_(dimmer) {}
38 ui::Layer* layer() { return dimmer_->dimming_layer_.get(); }
40 private:
41 ScreenDimmer* dimmer_; // not owned
43 DISALLOW_COPY_AND_ASSIGN(TestApi);
46 explicit ScreenDimmer(aura::RootWindow* root_window);
47 virtual ~ScreenDimmer();
49 // Dim or undim the root window.
50 void SetDimming(bool should_dim);
52 // aura::WindowObserver overrides:
53 virtual void OnWindowBoundsChanged(aura::Window* root_window,
54 const gfx::Rect& old_bounds,
55 const gfx::Rect& new_bounds) OVERRIDE;
57 private:
58 friend class TestApi;
60 aura::RootWindow* root_window_;
62 // Partially-opaque layer that's stacked above all of the root window's
63 // children and used to dim the screen. NULL until the first time we dim.
64 scoped_ptr<ui::Layer> dimming_layer_;
66 // Are we currently dimming the screen?
67 bool currently_dimming_;
69 DISALLOW_COPY_AND_ASSIGN(ScreenDimmer);
72 } // namespace internal
73 } // namespace ash
75 #endif // ASH_WM_SCREEN_DIMMER_H_