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

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

Issue 15061006: views: Switch Checkbox over to LabelButton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: changes per review Created 7 years, 7 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
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/chromeos/power/tray_power.h" 5 #include "ash/system/chromeos/power/tray_power.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/shell_delegate.h" 9 #include "ash/shell_delegate.h"
10 #include "ash/system/chromeos/power/power_status_view.h" 10 #include "ash/system/chromeos/power/power_status_view.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 199
200 } // namespace tray 200 } // namespace tray
201 201
202 using tray::PowerNotificationView; 202 using tray::PowerNotificationView;
203 203
204 TrayPower::TrayPower(SystemTray* system_tray) 204 TrayPower::TrayPower(SystemTray* system_tray)
205 : SystemTrayItem(system_tray), 205 : SystemTrayItem(system_tray),
206 power_tray_(NULL), 206 power_tray_(NULL),
207 notification_view_(NULL), 207 notification_view_(NULL),
208 notification_state_(NOTIFICATION_NONE) { 208 notification_state_(NOTIFICATION_NONE) {
209 PowerManagerHandler::Get()->AddObserver(this); 209 //PowerManagerHandler::Get()->AddObserver(this);
210 } 210 }
211 211
212 TrayPower::~TrayPower() { 212 TrayPower::~TrayPower() {
213 if (PowerManagerHandler::IsInitialized()) 213 if (PowerManagerHandler::IsInitialized())
214 PowerManagerHandler::Get()->RemoveObserver(this); 214 PowerManagerHandler::Get()->RemoveObserver(this);
215 } 215 }
216 216
217 // static 217 // static
218 bool TrayPower::IsBatteryChargingUnreliable( 218 bool TrayPower::IsBatteryChargingUnreliable(
219 const chromeos::PowerSupplyStatus& supply_status) { 219 const chromeos::PowerSupplyStatus& supply_status) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 int TrayPower::GetRoundedBatteryPercentage(double battery_percentage) { 334 int TrayPower::GetRoundedBatteryPercentage(double battery_percentage) {
335 DCHECK(battery_percentage >= 0.0); 335 DCHECK(battery_percentage >= 0.0);
336 return std::max(kMinBatteryPercent, 336 return std::max(kMinBatteryPercent,
337 static_cast<int>(battery_percentage + 0.5)); 337 static_cast<int>(battery_percentage + 0.5));
338 } 338 }
339 339
340 views::View* TrayPower::CreateTrayView(user::LoginStatus status) { 340 views::View* TrayPower::CreateTrayView(user::LoginStatus status) {
341 // There may not be enough information when this is created about whether 341 // There may not be enough information when this is created about whether
342 // there is a battery or not. So always create this, and adjust visibility as 342 // there is a battery or not. So always create this, and adjust visibility as
343 // necessary. 343 // necessary.
344 PowerSupplyStatus power_status = 344 // PowerSupplyStatus power_status =
345 PowerManagerHandler::Get()->GetPowerSupplyStatus(); 345 // PowerManagerHandler::Get()->GetPowerSupplyStatus();
346 CHECK(power_tray_ == NULL); 346 CHECK(power_tray_ == NULL);
347 power_tray_ = new tray::PowerTrayView(); 347 power_tray_ = new tray::PowerTrayView();
348 power_tray_->UpdatePowerStatus(power_status, false); 348 // power_tray_->UpdatePowerStatus(power_status, false);
349 return power_tray_; 349 return power_tray_;
350 } 350 }
351 351
352 views::View* TrayPower::CreateDefaultView(user::LoginStatus status) { 352 views::View* TrayPower::CreateDefaultView(user::LoginStatus status) {
353 // Make sure icon status is up-to-date. (Also triggers stub activation). 353 // Make sure icon status is up-to-date. (Also triggers stub activation).
354 RequestStatusUpdate(); 354 RequestStatusUpdate();
355 return NULL; 355 return NULL;
356 } 356 }
357 357
358 views::View* TrayPower::CreateNotificationView(user::LoginStatus status) { 358 views::View* TrayPower::CreateNotificationView(user::LoginStatus status) {
359 CHECK(notification_view_ == NULL); 359 CHECK(notification_view_ == NULL);
360 PowerSupplyStatus power_status = 360 // PowerSupplyStatus power_status =
361 PowerManagerHandler::Get()->GetPowerSupplyStatus(); 361 // PowerManagerHandler::Get()->GetPowerSupplyStatus();
362 if (!power_status.battery_is_present) 362 // if (!power_status.battery_is_present)
363 return NULL; 363 // return NULL;
364 364
365 notification_view_ = new PowerNotificationView(this); 365 notification_view_ = new PowerNotificationView(this);
366 notification_view_->UpdatePowerStatus(power_status); 366 // notification_view_->UpdatePowerStatus(power_status);
367 367
368 return notification_view_; 368 return notification_view_;
369 } 369 }
370 370
371 void TrayPower::DestroyTrayView() { 371 void TrayPower::DestroyTrayView() {
372 power_tray_ = NULL; 372 power_tray_ = NULL;
373 } 373 }
374 374
375 void TrayPower::DestroyDefaultView() { 375 void TrayPower::DestroyDefaultView() {
376 } 376 }
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 return false; 477 return false;
478 case NOTIFICATION_CRITICAL: 478 case NOTIFICATION_CRITICAL:
479 return false; 479 return false;
480 } 480 }
481 NOTREACHED(); 481 NOTREACHED();
482 return false; 482 return false;
483 } 483 }
484 484
485 } // namespace internal 485 } // namespace internal
486 } // namespace ash 486 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/chromeos/settings/tray_settings.cc » ('j') | ui/views/controls/button/button.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698