Chromium Code Reviews| 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/power/tray_power.h" | 5 #include "ash/system/power/tray_power.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/date/date_view.h" | 8 #include "ash/system/date/date_view.h" |
| 9 #include "ash/system/power/power_supply_status.h" | 9 #include "ash/system/power/power_supply_status.h" |
| 10 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 193 SkColorSetRGB(0xf1, 0xf1, 0xf1))); | 193 SkColorSetRGB(0xf1, 0xf1, 0xf1))); |
| 194 container->AddChildView(date_.get()); | 194 container->AddChildView(date_.get()); |
| 195 | 195 |
| 196 PowerSupplyStatus power_status = | 196 PowerSupplyStatus power_status = |
| 197 ash::Shell::GetInstance()->tray_delegate()->GetPowerSupplyStatus(); | 197 ash::Shell::GetInstance()->tray_delegate()->GetPowerSupplyStatus(); |
| 198 if (power_status.battery_is_present) { | 198 if (power_status.battery_is_present) { |
| 199 power_.reset(new tray::PowerPopupView()); | 199 power_.reset(new tray::PowerPopupView()); |
| 200 power_->UpdatePowerStatus(power_status); | 200 power_->UpdatePowerStatus(power_status); |
| 201 container->AddChildView(power_.get()); | 201 container->AddChildView(power_.get()); |
| 202 } | 202 } |
| 203 ash::Shell::GetInstance()->tray_delegate()->RequestStatusUpdate(); | |
| 204 | |
|
sky
2012/04/11 20:51:35
nit: I don't find this newline helping readability
| |
| 203 return container; | 205 return container; |
| 204 } | 206 } |
| 205 | 207 |
| 206 views::View* TrayPower::CreateDetailedView(user::LoginStatus status) { | 208 views::View* TrayPower::CreateDetailedView(user::LoginStatus status) { |
| 207 return NULL; | 209 return NULL; |
| 208 } | 210 } |
| 209 | 211 |
| 210 void TrayPower::DestroyTrayView() { | 212 void TrayPower::DestroyTrayView() { |
| 211 power_tray_.reset(); | 213 power_tray_.reset(); |
| 212 } | 214 } |
| 213 | 215 |
| 214 void TrayPower::DestroyDefaultView() { | 216 void TrayPower::DestroyDefaultView() { |
| 215 date_.reset(); | 217 date_.reset(); |
| 216 power_.reset(); | 218 power_.reset(); |
| 217 } | 219 } |
| 218 | 220 |
| 219 void TrayPower::DestroyDetailedView() { | 221 void TrayPower::DestroyDetailedView() { |
| 220 } | 222 } |
| 221 | 223 |
| 222 void TrayPower::OnPowerStatusChanged(const PowerSupplyStatus& status) { | 224 void TrayPower::OnPowerStatusChanged(const PowerSupplyStatus& status) { |
| 223 if (power_tray_.get()) | 225 if (power_tray_.get()) |
| 224 power_tray_->UpdatePowerStatus(status); | 226 power_tray_->UpdatePowerStatus(status); |
| 225 if (power_.get()) | 227 if (power_.get()) |
| 226 power_->UpdatePowerStatus(status); | 228 power_->UpdatePowerStatus(status); |
| 227 } | 229 } |
| 228 | 230 |
| 229 } // namespace internal | 231 } // namespace internal |
| 230 } // namespace ash | 232 } // namespace ash |
| OLD | NEW |