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

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

Issue 107103004: Implement the spring charger replacement UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 7 years 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/system/chromeos/power/power_status_view.h" 9 #include "ash/system/chromeos/power/power_status_view.h"
9 #include "ash/system/date/date_view.h" 10 #include "ash/system/date/date_view.h"
10 #include "ash/system/system_notifier.h" 11 #include "ash/system/system_notifier.h"
12 #include "ash/system/tray/system_tray_delegate.h"
11 #include "ash/system/tray/tray_constants.h" 13 #include "ash/system/tray/tray_constants.h"
12 #include "ash/system/tray/tray_notification_view.h" 14 #include "ash/system/tray/tray_notification_view.h"
13 #include "ash/system/tray/tray_utils.h" 15 #include "ash/system/tray/tray_utils.h"
14 #include "base/command_line.h" 16 #include "base/command_line.h"
15 #include "grit/ash_resources.h" 17 #include "grit/ash_resources.h"
16 #include "grit/ash_strings.h" 18 #include "grit/ash_strings.h"
17 #include "third_party/icu/source/i18n/unicode/fieldpos.h" 19 #include "third_party/icu/source/i18n/unicode/fieldpos.h"
18 #include "third_party/icu/source/i18n/unicode/fmtable.h" 20 #include "third_party/icu/source/i18n/unicode/fmtable.h"
19 #include "ui/base/accessibility/accessible_view_state.h" 21 #include "ui/base/accessibility/accessible_view_state.h"
20 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 157 }
156 158
157 void TrayPower::UpdateAfterLoginStatusChange(user::LoginStatus status) { 159 void TrayPower::UpdateAfterLoginStatusChange(user::LoginStatus status) {
158 } 160 }
159 161
160 void TrayPower::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { 162 void TrayPower::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) {
161 SetTrayImageItemBorder(power_tray_, alignment); 163 SetTrayImageItemBorder(power_tray_, alignment);
162 } 164 }
163 165
164 void TrayPower::OnPowerStatusChanged() { 166 void TrayPower::OnPowerStatusChanged() {
167 // Show spring charger replacement dialog if necessary.
168 ShowChargerReplacementDialogIfNecessary();
169
165 bool battery_alert = UpdateNotificationState(); 170 bool battery_alert = UpdateNotificationState();
166 if (power_tray_) 171 if (power_tray_)
167 power_tray_->UpdateStatus(battery_alert); 172 power_tray_->UpdateStatus(battery_alert);
168 if (notification_view_) 173 if (notification_view_)
169 notification_view_->UpdateStatus(); 174 notification_view_->UpdateStatus();
170 175
171 // Factory testing may place the battery into unusual states. 176 // Factory testing may place the battery into unusual states.
172 if (CommandLine::ForCurrentProcess()->HasSwitch( 177 if (CommandLine::ForCurrentProcess()->HasSwitch(
173 ash::switches::kAshHideNotificationsForFactory)) 178 ash::switches::kAshHideNotificationsForFactory))
174 return; 179 return;
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 return true; 297 return true;
293 } 298 }
294 return false; 299 return false;
295 case NOTIFICATION_CRITICAL: 300 case NOTIFICATION_CRITICAL:
296 return false; 301 return false;
297 } 302 }
298 NOTREACHED(); 303 NOTREACHED();
299 return false; 304 return false;
300 } 305 }
301 306
307 void TrayPower::ShowChargerReplacementDialogIfNecessary() {
Daniel Erat 2013/12/06 17:43:26 this separate method seems unnecessary; mind just
jennyz 2013/12/06 18:15:16 Done.
308 if (!PowerStatus::Get()->IsOriginalSpringChargerConnected())
309 return;
310
311 ash::Shell::GetInstance()->system_tray_delegate()->
312 ShowSpringChargerReplacementDialog();
313 }
314
302 } // namespace internal 315 } // namespace internal
303 } // namespace ash 316 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698