| Index: ash/system/chromeos/power/tray_power.cc | 
| diff --git a/ash/system/chromeos/power/tray_power.cc b/ash/system/chromeos/power/tray_power.cc | 
| index 969a1ddf75a4859e86035db897e1455603d4aeb4..581d03c09dad5d7163a9fa369b17c52a4c8d177b 100644 | 
| --- a/ash/system/chromeos/power/tray_power.cc | 
| +++ b/ash/system/chromeos/power/tray_power.cc | 
| @@ -7,32 +7,23 @@ | 
| #include "ash/accessibility_delegate.h" | 
| #include "ash/ash_switches.h" | 
| #include "ash/shell.h" | 
| -#include "ash/system/chromeos/power/power_status_view.h" | 
| +#include "ash/system/chromeos/power/battery_notification.h" | 
| #include "ash/system/date/date_view.h" | 
| #include "ash/system/system_notifier.h" | 
| #include "ash/system/tray/system_tray_delegate.h" | 
| #include "ash/system/tray/tray_constants.h" | 
| -#include "ash/system/tray/tray_notification_view.h" | 
| #include "ash/system/tray/tray_utils.h" | 
| #include "base/command_line.h" | 
| #include "base/metrics/histogram.h" | 
| #include "base/time/time.h" | 
| #include "grit/ash_resources.h" | 
| #include "grit/ash_strings.h" | 
| -#include "third_party/icu/source/i18n/unicode/fieldpos.h" | 
| -#include "third_party/icu/source/i18n/unicode/fmtable.h" | 
| #include "ui/accessibility/ax_view_state.h" | 
| #include "ui/base/resource/resource_bundle.h" | 
| #include "ui/message_center/message_center.h" | 
| #include "ui/message_center/notification.h" | 
| -#include "ui/views/controls/button/button.h" | 
| #include "ui/views/controls/image_view.h" | 
| -#include "ui/views/controls/label.h" | 
| -#include "ui/views/layout/box_layout.h" | 
| -#include "ui/views/layout/fill_layout.h" | 
| -#include "ui/views/layout/grid_layout.h" | 
| #include "ui/views/view.h" | 
| -#include "ui/views/widget/widget.h" | 
|  | 
| using message_center::MessageCenter; | 
| using message_center::Notification; | 
| @@ -75,29 +66,8 @@ class PowerTrayView : public views::ImageView { | 
| DISALLOW_COPY_AND_ASSIGN(PowerTrayView); | 
| }; | 
|  | 
| -class PowerNotificationView : public TrayNotificationView { | 
| - public: | 
| -  explicit PowerNotificationView(TrayPower* owner) | 
| -      : TrayNotificationView(owner, 0) { | 
| -    power_status_view_ = | 
| -        new PowerStatusView(PowerStatusView::VIEW_NOTIFICATION, true); | 
| -    InitView(power_status_view_); | 
| -  } | 
| - | 
| -  void UpdateStatus() { | 
| -    SetIconImage(PowerStatus::Get()->GetBatteryImage(PowerStatus::ICON_DARK)); | 
| -  } | 
| - | 
| - private: | 
| -  PowerStatusView* power_status_view_; | 
| - | 
| -  DISALLOW_COPY_AND_ASSIGN(PowerNotificationView); | 
| -}; | 
| - | 
| }  // namespace tray | 
|  | 
| -using tray::PowerNotificationView; | 
| - | 
| const int TrayPower::kCriticalMinutes = 5; | 
| const int TrayPower::kLowPowerMinutes = 15; | 
| const int TrayPower::kNoWarningMinutes = 30; | 
| @@ -109,7 +79,7 @@ TrayPower::TrayPower(SystemTray* system_tray, MessageCenter* message_center) | 
| : SystemTrayItem(system_tray), | 
| message_center_(message_center), | 
| power_tray_(NULL), | 
| -      notification_view_(NULL), | 
| +      battery_notification_(new BatteryNotification(message_center)), | 
| notification_state_(NOTIFICATION_NONE), | 
| usb_charger_was_connected_(false), | 
| line_power_was_connected_(false) { | 
| @@ -136,17 +106,6 @@ views::View* TrayPower::CreateDefaultView(user::LoginStatus status) { | 
| return NULL; | 
| } | 
|  | 
| -views::View* TrayPower::CreateNotificationView(user::LoginStatus status) { | 
| -  CHECK(notification_view_ == NULL); | 
| -  if (!PowerStatus::Get()->IsBatteryPresent()) | 
| -    return NULL; | 
| - | 
| -  notification_view_ = new PowerNotificationView(this); | 
| -  notification_view_->UpdateStatus(); | 
| - | 
| -  return notification_view_; | 
| -} | 
| - | 
| void TrayPower::DestroyTrayView() { | 
| power_tray_ = NULL; | 
| } | 
| @@ -154,10 +113,6 @@ void TrayPower::DestroyTrayView() { | 
| void TrayPower::DestroyDefaultView() { | 
| } | 
|  | 
| -void TrayPower::DestroyNotificationView() { | 
| -  notification_view_ = NULL; | 
| -} | 
| - | 
| void TrayPower::UpdateAfterLoginStatusChange(user::LoginStatus status) { | 
| } | 
|  | 
| @@ -166,11 +121,10 @@ void TrayPower::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { | 
| } | 
|  | 
| void TrayPower::OnPowerStatusChanged() { | 
| +  NotificationState old_notification_state = notification_state_; | 
| bool battery_alert = UpdateNotificationState(); | 
| if (power_tray_) | 
| power_tray_->UpdateStatus(battery_alert); | 
| -  if (notification_view_) | 
| -    notification_view_->UpdateStatus(); | 
|  | 
| // Factory testing may place the battery into unusual states. | 
| if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 
| @@ -179,10 +133,14 @@ void TrayPower::OnPowerStatusChanged() { | 
|  | 
| MaybeShowUsbChargerNotification(); | 
|  | 
| -  if (battery_alert) | 
| -    ShowNotificationView(); | 
| -  else if (notification_state_ == NOTIFICATION_NONE) | 
| -    HideNotificationView(); | 
| +  if (battery_alert) { | 
| +    battery_notification_->Show(notification_state_); | 
| +  } else if (notification_state_ == NOTIFICATION_NONE && | 
| +             old_notification_state != NOTIFICATION_NONE) { | 
| +    battery_notification_->Hide(); | 
| +  } else if (notification_state_ != NOTIFICATION_NONE) { | 
| +    battery_notification_->Update(notification_state_); | 
| +  } | 
|  | 
| usb_charger_was_connected_ = PowerStatus::Get()->IsUsbChargerConnected(); | 
| line_power_was_connected_ = PowerStatus::Get()->IsLinePowerConnected(); | 
|  |