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

Side by Side Diff: ash/common/system/chromeos/brightness/tray_brightness.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
OLDNEW
(Empty)
1 // Copyright 2013 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_SYSTEM_CHROMEOS_BRIGHTNESS_TRAY_BRIGHTNESS_H_
6 #define ASH_COMMON_SYSTEM_CHROMEOS_BRIGHTNESS_TRAY_BRIGHTNESS_H_
7
8 #include "ash/common/system/tray/system_tray_item.h"
9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chromeos/dbus/power_manager_client.h"
12
13 namespace ash {
14 namespace tray {
15 class BrightnessView;
16 }
17
18 class ASH_EXPORT TrayBrightness
19 : public SystemTrayItem,
20 public chromeos::PowerManagerClient::Observer {
21 public:
22 explicit TrayBrightness(SystemTray* system_tray);
23 ~TrayBrightness() override;
24
25 private:
26 friend class TrayBrightnessTest;
27
28 // Sends a request to get the current screen brightness so |current_percent_|
29 // can be initialized.
30 void GetInitialBrightness();
31
32 // Updates |current_percent_| with the initial brightness requested by
33 // GetInitialBrightness(), if we haven't seen the brightness already in the
34 // meantime.
35 void HandleInitialBrightness(double percent);
36
37 // Overridden from SystemTrayItem.
38 views::View* CreateTrayView(LoginStatus status) override;
39 views::View* CreateDefaultView(LoginStatus status) override;
40 views::View* CreateDetailedView(LoginStatus status) override;
41 void DestroyTrayView() override;
42 void DestroyDefaultView() override;
43 void DestroyDetailedView() override;
44 void UpdateAfterLoginStatusChange(LoginStatus status) override;
45 bool ShouldShowShelf() const override;
46
47 // Overriden from PowerManagerClient::Observer.
48 void BrightnessChanged(int level, bool user_initiated) override;
49
50 void HandleBrightnessChanged(double percent, bool user_initiated);
51
52 tray::BrightnessView* brightness_view_;
53
54 // Brightness level in the range [0.0, 100.0] that we've heard about most
55 // recently.
56 double current_percent_;
57
58 // Has |current_percent_| been initialized?
59 bool got_current_percent_;
60
61 base::WeakPtrFactory<TrayBrightness> weak_ptr_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(TrayBrightness);
64 };
65
66 } // namespace ash
67
68 #endif // ASH_COMMON_SYSTEM_CHROMEOS_BRIGHTNESS_TRAY_BRIGHTNESS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698