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

Side by Side Diff: ash/system/power/tray_power.cc

Issue 9983002: Pass correct initial/user values when requesting power status (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add SystemTrayDelegate::RequestStatusUpdate Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « ash/shell.cc ('k') | ash/system/tray/system_tray_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « ash/shell.cc ('k') | ash/system/tray/system_tray_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698