OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/common/system/chromeos/brightness/tray_brightness.h" | 5 #include "ash/common/system/chromeos/brightness/tray_brightness.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
10 #include "ash/common/shell_observer.h" | 10 #include "ash/common/shell_observer.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 void BrightnessView::SliderDragEnded(views::Slider* slider) { | 165 void BrightnessView::SliderDragEnded(views::Slider* slider) { |
166 DCHECK_EQ(slider, slider_); | 166 DCHECK_EQ(slider, slider_); |
167 dragging_ = false; | 167 dragging_ = false; |
168 slider_->SetValue(static_cast<float>(last_percent_ / 100.0)); | 168 slider_->SetValue(static_cast<float>(last_percent_ / 100.0)); |
169 } | 169 } |
170 | 170 |
171 } // namespace tray | 171 } // namespace tray |
172 | 172 |
173 TrayBrightness::TrayBrightness(SystemTray* system_tray) | 173 TrayBrightness::TrayBrightness(SystemTray* system_tray) |
174 : SystemTrayItem(system_tray), | 174 : SystemTrayItem(system_tray, UMA_DISPLAY_BRIGHTNESS), |
175 brightness_view_(NULL), | 175 brightness_view_(NULL), |
176 current_percent_(100.0), | 176 current_percent_(100.0), |
177 got_current_percent_(false), | 177 got_current_percent_(false), |
178 weak_ptr_factory_(this) { | 178 weak_ptr_factory_(this) { |
179 // Post a task to get the initial brightness; the BrightnessControlDelegate | 179 // Post a task to get the initial brightness; the BrightnessControlDelegate |
180 // isn't created yet. | 180 // isn't created yet. |
181 base::ThreadTaskRunnerHandle::Get()->PostTask( | 181 base::ThreadTaskRunnerHandle::Get()->PostTask( |
182 FROM_HERE, base::Bind(&TrayBrightness::GetInitialBrightness, | 182 FROM_HERE, base::Bind(&TrayBrightness::GetInitialBrightness, |
183 weak_ptr_factory_.GetWeakPtr())); | 183 weak_ptr_factory_.GetWeakPtr())); |
184 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( | 184 chromeos::DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver( |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 if (!display::Display::HasInternalDisplay()) | 269 if (!display::Display::HasInternalDisplay()) |
270 return; | 270 return; |
271 | 271 |
272 if (brightness_view_) | 272 if (brightness_view_) |
273 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); | 273 SetDetailedViewCloseDelay(kTrayPopupAutoCloseDelayInSeconds); |
274 else | 274 else |
275 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); | 275 PopupDetailedView(kTrayPopupAutoCloseDelayInSeconds, false); |
276 } | 276 } |
277 | 277 |
278 } // namespace ash | 278 } // namespace ash |
OLD | NEW |