OLD | NEW |
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 #include "ash/system/brightness/tray_brightness.h" | 5 #include "ash/system/brightness/tray_brightness.h" |
6 | 6 |
7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
8 #include "ash/ash_constants.h" | 8 #include "ash/ash_constants.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/brightness/brightness_control_delegate.h" | 10 #include "ash/system/brightness/brightness_control_delegate.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 bool dragging_; | 117 bool dragging_; |
118 | 118 |
119 // Last brightness level that we observed, in the range [0.0, 100.0]. | 119 // Last brightness level that we observed, in the range [0.0, 100.0]. |
120 double last_percent_; | 120 double last_percent_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(BrightnessView); | 122 DISALLOW_COPY_AND_ASSIGN(BrightnessView); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace tray | 125 } // namespace tray |
126 | 126 |
127 TrayBrightness::TrayBrightness() | 127 TrayBrightness::TrayBrightness(SystemTray* system_tray) |
128 : weak_ptr_factory_(this), | 128 : SystemTrayItem(system_tray), |
| 129 weak_ptr_factory_(this), |
129 brightness_view_(NULL), | 130 brightness_view_(NULL), |
130 is_default_view_(false), | 131 is_default_view_(false), |
131 current_percent_(100.0), | 132 current_percent_(100.0), |
132 got_current_percent_(false) { | 133 got_current_percent_(false) { |
133 // Post a task to get the initial brightness; the BrightnessControlDelegate | 134 // Post a task to get the initial brightness; the BrightnessControlDelegate |
134 // isn't created yet. | 135 // isn't created yet. |
135 MessageLoopForUI::current()->PostTask( | 136 MessageLoopForUI::current()->PostTask( |
136 FROM_HERE, | 137 FROM_HERE, |
137 base::Bind(&TrayBrightness::GetInitialBrightness, | 138 base::Bind(&TrayBrightness::GetInitialBrightness, |
138 weak_ptr_factory_.GetWeakPtr())); | 139 weak_ptr_factory_.GetWeakPtr())); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 return; | 203 return; |
203 | 204 |
204 if (brightness_view_) | 205 if (brightness_view_) |
205 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); | 206 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); |
206 else | 207 else |
207 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); | 208 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); |
208 } | 209 } |
209 | 210 |
210 } // namespace internal | 211 } // namespace internal |
211 } // namespace ash | 212 } // namespace ash |
OLD | NEW |