| 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/tray_update.h" | 5 #include "ash/system/tray_update.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shelf/shelf_widget.h" | 9 #include "ash/shelf/shelf_widget.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 AddChildView(image); | 77 AddChildView(image); |
| 78 AddChildView(new views::Label( | 78 AddChildView(new views::Label( |
| 79 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE))); | 79 bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE))); |
| 80 SetAccessibleName(bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE)); | 80 SetAccessibleName(bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE)); |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual ~UpdateView() {} | 83 virtual ~UpdateView() {} |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 // Overridden from ActionableView. | 86 // Overridden from ActionableView. |
| 87 virtual bool PerformAction(const ui::Event& event) OVERRIDE { | 87 virtual bool PerformAction(const ui::Event& event) override { |
| 88 ash::Shell::GetInstance()-> | 88 ash::Shell::GetInstance()-> |
| 89 system_tray_delegate()->RequestRestartForUpdate(); | 89 system_tray_delegate()->RequestRestartForUpdate(); |
| 90 return true; | 90 return true; |
| 91 } | 91 } |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(UpdateView); | 93 DISALLOW_COPY_AND_ASSIGN(UpdateView); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } | 96 } |
| 97 | 97 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 124 &UpdateNagger::Nag); | 124 &UpdateNagger::Nag); |
| 125 } | 125 } |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 void Nag() { | 128 void Nag() { |
| 129 owner_->PopupDetailedView(kShowUpdateNaggerForSeconds, false); | 129 owner_->PopupDetailedView(kShowUpdateNaggerForSeconds, false); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Overridden from ui::LayerAnimationObserver. | 132 // Overridden from ui::LayerAnimationObserver. |
| 133 virtual void OnLayerAnimationEnded( | 133 virtual void OnLayerAnimationEnded( |
| 134 ui::LayerAnimationSequence* sequence) OVERRIDE { | 134 ui::LayerAnimationSequence* sequence) override { |
| 135 // TODO(oshima): Find out if the updator will be shown on non | 135 // TODO(oshima): Find out if the updator will be shown on non |
| 136 // primary display. | 136 // primary display. |
| 137 if (Shell::GetPrimaryRootWindowController()->shelf()->IsVisible()) | 137 if (Shell::GetPrimaryRootWindowController()->shelf()->IsVisible()) |
| 138 timer_.Stop(); | 138 timer_.Stop(); |
| 139 else if (!timer_.IsRunning()) | 139 else if (!timer_.IsRunning()) |
| 140 RestartTimer(); | 140 RestartTimer(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 virtual void OnLayerAnimationAborted( | 143 virtual void OnLayerAnimationAborted( |
| 144 ui::LayerAnimationSequence* sequence) OVERRIDE {} | 144 ui::LayerAnimationSequence* sequence) override {} |
| 145 | 145 |
| 146 virtual void OnLayerAnimationScheduled( | 146 virtual void OnLayerAnimationScheduled( |
| 147 ui::LayerAnimationSequence* sequence) OVERRIDE {} | 147 ui::LayerAnimationSequence* sequence) override {} |
| 148 | 148 |
| 149 SystemTrayItem* owner_; | 149 SystemTrayItem* owner_; |
| 150 base::OneShotTimer<UpdateNagger> timer_; | 150 base::OneShotTimer<UpdateNagger> timer_; |
| 151 | 151 |
| 152 DISALLOW_COPY_AND_ASSIGN(UpdateNagger); | 152 DISALLOW_COPY_AND_ASSIGN(UpdateNagger); |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace tray | 155 } // namespace tray |
| 156 | 156 |
| 157 TrayUpdate::TrayUpdate(SystemTray* system_tray) | 157 TrayUpdate::TrayUpdate(SystemTray* system_tray) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 SetImageFromResourceId(DecideResource(severity_, false)); | 193 SetImageFromResourceId(DecideResource(severity_, false)); |
| 194 tray_view()->SetVisible(true); | 194 tray_view()->SetVisible(true); |
| 195 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && | 195 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && |
| 196 !nagger_.get()) { | 196 !nagger_.get()) { |
| 197 // The shelf is not visible, and there is no nagger scheduled. | 197 // The shelf is not visible, and there is no nagger scheduled. |
| 198 nagger_.reset(new tray::UpdateNagger(this)); | 198 nagger_.reset(new tray::UpdateNagger(this)); |
| 199 } | 199 } |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace ash | 202 } // namespace ash |
| OLD | NEW |