| 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/chromeos/power/tray_power.h" | 5 #include "ash/system/chromeos/power/tray_power.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/common/accessibility_delegate.h" | 10 #include "ash/common/accessibility_delegate.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 line_power_was_connected_(false), | 154 line_power_was_connected_(false), |
| 155 usb_notification_dismissed_(false) { | 155 usb_notification_dismissed_(false) { |
| 156 PowerStatus::Get()->AddObserver(this); | 156 PowerStatus::Get()->AddObserver(this); |
| 157 } | 157 } |
| 158 | 158 |
| 159 TrayPower::~TrayPower() { | 159 TrayPower::~TrayPower() { |
| 160 PowerStatus::Get()->RemoveObserver(this); | 160 PowerStatus::Get()->RemoveObserver(this); |
| 161 message_center_->RemoveNotification(kUsbNotificationId, false); | 161 message_center_->RemoveNotification(kUsbNotificationId, false); |
| 162 } | 162 } |
| 163 | 163 |
| 164 views::View* TrayPower::CreateTrayView(user::LoginStatus status) { | 164 views::View* TrayPower::CreateTrayView(LoginStatus status) { |
| 165 // There may not be enough information when this is created about whether | 165 // There may not be enough information when this is created about whether |
| 166 // there is a battery or not. So always create this, and adjust visibility as | 166 // there is a battery or not. So always create this, and adjust visibility as |
| 167 // necessary. | 167 // necessary. |
| 168 CHECK(power_tray_ == NULL); | 168 CHECK(power_tray_ == NULL); |
| 169 power_tray_ = new tray::PowerTrayView(); | 169 power_tray_ = new tray::PowerTrayView(); |
| 170 power_tray_->UpdateStatus(false); | 170 power_tray_->UpdateStatus(false); |
| 171 return power_tray_; | 171 return power_tray_; |
| 172 } | 172 } |
| 173 | 173 |
| 174 views::View* TrayPower::CreateDefaultView(user::LoginStatus status) { | 174 views::View* TrayPower::CreateDefaultView(LoginStatus status) { |
| 175 // Make sure icon status is up-to-date. (Also triggers stub activation). | 175 // Make sure icon status is up-to-date. (Also triggers stub activation). |
| 176 PowerStatus::Get()->RequestStatusUpdate(); | 176 PowerStatus::Get()->RequestStatusUpdate(); |
| 177 return NULL; | 177 return NULL; |
| 178 } | 178 } |
| 179 | 179 |
| 180 void TrayPower::DestroyTrayView() { | 180 void TrayPower::DestroyTrayView() { |
| 181 power_tray_ = NULL; | 181 power_tray_ = NULL; |
| 182 } | 182 } |
| 183 | 183 |
| 184 void TrayPower::DestroyDefaultView() { | 184 void TrayPower::DestroyDefaultView() { |
| 185 } | 185 } |
| 186 | 186 |
| 187 void TrayPower::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 187 void TrayPower::UpdateAfterLoginStatusChange(LoginStatus status) {} |
| 188 } | |
| 189 | 188 |
| 190 void TrayPower::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { | 189 void TrayPower::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { |
| 191 SetTrayImageItemBorder(power_tray_, alignment); | 190 SetTrayImageItemBorder(power_tray_, alignment); |
| 192 } | 191 } |
| 193 | 192 |
| 194 void TrayPower::OnPowerStatusChanged() { | 193 void TrayPower::OnPowerStatusChanged() { |
| 195 bool battery_alert = UpdateNotificationState(); | 194 bool battery_alert = UpdateNotificationState(); |
| 196 if (power_tray_) | 195 if (power_tray_) |
| 197 power_tray_->UpdateStatus(battery_alert); | 196 power_tray_->UpdateStatus(battery_alert); |
| 198 | 197 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } | 355 } |
| 357 NOTREACHED(); | 356 NOTREACHED(); |
| 358 return false; | 357 return false; |
| 359 } | 358 } |
| 360 | 359 |
| 361 void TrayPower::NotifyUsbNotificationClosedByUser() { | 360 void TrayPower::NotifyUsbNotificationClosedByUser() { |
| 362 usb_notification_dismissed_ = true; | 361 usb_notification_dismissed_ = true; |
| 363 } | 362 } |
| 364 | 363 |
| 365 } // namespace ash | 364 } // namespace ash |
| OLD | NEW |