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/shell.h" | 8 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
9 #include "ash/system/tray/system_tray_delegate.h" | 10 #include "ash/system/tray/system_tray_delegate.h" |
10 #include "ash/system/tray/tray_constants.h" | 11 #include "ash/system/tray/tray_constants.h" |
11 #include "ash/system/tray/tray_views.h" | 12 #include "ash/system/tray/tray_views.h" |
12 #include "ash/wm/shelf_layout_manager.h" | 13 #include "ash/wm/shelf_layout_manager.h" |
13 #include "base/time.h" | 14 #include "base/time.h" |
14 #include "base/timer.h" | 15 #include "base/timer.h" |
15 #include "grit/ash_resources.h" | 16 #include "grit/ash_resources.h" |
16 #include "grit/ash_strings.h" | 17 #include "grit/ash_strings.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 119 } |
119 | 120 |
120 private: | 121 private: |
121 void Nag() { | 122 void Nag() { |
122 owner_->PopupDetailedView(kShowUpdateNaggerForSeconds, false); | 123 owner_->PopupDetailedView(kShowUpdateNaggerForSeconds, false); |
123 } | 124 } |
124 | 125 |
125 // Overridden from ui::LayerAnimationObserver. | 126 // Overridden from ui::LayerAnimationObserver. |
126 virtual void OnLayerAnimationEnded( | 127 virtual void OnLayerAnimationEnded( |
127 ui::LayerAnimationSequence* sequence) OVERRIDE { | 128 ui::LayerAnimationSequence* sequence) OVERRIDE { |
128 if (Shell::GetInstance()->shelf()->IsVisible()) | 129 // TODO(oshima): Find out if the updator will be shown on non |
| 130 // primary display. |
| 131 if (Shell::GetPrimaryRootWindowController()->shelf()->IsVisible()) |
129 timer_.Stop(); | 132 timer_.Stop(); |
130 else if (!timer_.IsRunning()) | 133 else if (!timer_.IsRunning()) |
131 RestartTimer(); | 134 RestartTimer(); |
132 } | 135 } |
133 | 136 |
134 virtual void OnLayerAnimationAborted( | 137 virtual void OnLayerAnimationAborted( |
135 ui::LayerAnimationSequence* sequence) OVERRIDE {} | 138 ui::LayerAnimationSequence* sequence) OVERRIDE {} |
136 | 139 |
137 virtual void OnLayerAnimationScheduled( | 140 virtual void OnLayerAnimationScheduled( |
138 ui::LayerAnimationSequence* sequence) OVERRIDE {} | 141 ui::LayerAnimationSequence* sequence) OVERRIDE {} |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // didn't click on it to restart. In either case, start the timer to show | 176 // didn't click on it to restart. In either case, start the timer to show |
174 // the nag reminder again after the specified time. | 177 // the nag reminder again after the specified time. |
175 nagger_->RestartTimer(); | 178 nagger_->RestartTimer(); |
176 } | 179 } |
177 } | 180 } |
178 | 181 |
179 void TrayUpdate::OnUpdateRecommended(UpdateObserver::UpdateSeverity severity) { | 182 void TrayUpdate::OnUpdateRecommended(UpdateObserver::UpdateSeverity severity) { |
180 severity_ = severity; | 183 severity_ = severity; |
181 SetImageFromResourceId(DecideResource(severity_, false)); | 184 SetImageFromResourceId(DecideResource(severity_, false)); |
182 tray_view()->SetVisible(true); | 185 tray_view()->SetVisible(true); |
183 if (!Shell::GetInstance()->shelf()->IsVisible() && !nagger_.get()) { | 186 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && |
| 187 !nagger_.get()) { |
184 // The shelf is not visible, and there is no nagger scheduled. | 188 // The shelf is not visible, and there is no nagger scheduled. |
185 nagger_.reset(new tray::UpdateNagger(this)); | 189 nagger_.reset(new tray::UpdateNagger(this)); |
186 } | 190 } |
187 } | 191 } |
188 | 192 |
189 } // namespace internal | 193 } // namespace internal |
190 } // namespace ash | 194 } // namespace ash |
OLD | NEW |