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