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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 TrayUpdate::~TrayUpdate() { | 166 TrayUpdate::~TrayUpdate() { |
167 Shell::GetInstance()->system_tray_notifier()->RemoveUpdateObserver(this); | 167 Shell::GetInstance()->system_tray_notifier()->RemoveUpdateObserver(this); |
168 } | 168 } |
169 | 169 |
170 bool TrayUpdate::GetInitialVisibility() { | 170 bool TrayUpdate::GetInitialVisibility() { |
171 UpdateInfo info; | 171 UpdateInfo info; |
172 Shell::GetInstance()->system_tray_delegate()->GetSystemUpdateInfo(&info); | 172 Shell::GetInstance()->system_tray_delegate()->GetSystemUpdateInfo(&info); |
173 return info.update_required; | 173 return info.update_required; |
174 } | 174 } |
175 | 175 |
176 views::View* TrayUpdate::CreateDefaultView(user::LoginStatus status) { | 176 views::View* TrayUpdate::CreateDefaultView(LoginStatus status) { |
177 UpdateInfo info; | 177 UpdateInfo info; |
178 Shell::GetInstance()->system_tray_delegate()->GetSystemUpdateInfo(&info); | 178 Shell::GetInstance()->system_tray_delegate()->GetSystemUpdateInfo(&info); |
179 return info.update_required ? new UpdateView(info) : nullptr; | 179 return info.update_required ? new UpdateView(info) : nullptr; |
180 } | 180 } |
181 | 181 |
182 views::View* TrayUpdate::CreateDetailedView(user::LoginStatus status) { | 182 views::View* TrayUpdate::CreateDetailedView(LoginStatus status) { |
183 return CreateDefaultView(status); | 183 return CreateDefaultView(status); |
184 } | 184 } |
185 | 185 |
186 void TrayUpdate::DestroyDetailedView() { | 186 void TrayUpdate::DestroyDetailedView() { |
187 if (nagger_) { | 187 if (nagger_) { |
188 // The nagger was being displayed. Now that the detailed view is being | 188 // The nagger was being displayed. Now that the detailed view is being |
189 // closed, that means either the user clicks on it to restart, or the user | 189 // closed, that means either the user clicks on it to restart, or the user |
190 // didn't click on it to restart. In either case, start the timer to show | 190 // didn't click on it to restart. In either case, start the timer to show |
191 // the nag reminder again after the specified time. | 191 // the nag reminder again after the specified time. |
192 nagger_->RestartTimer(); | 192 nagger_->RestartTimer(); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { | 196 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { |
197 SetImageFromResourceId(DecideResource(info.severity, false)); | 197 SetImageFromResourceId(DecideResource(info.severity, false)); |
198 tray_view()->SetVisible(true); | 198 tray_view()->SetVisible(true); |
199 if (!Shell::GetPrimaryRootWindowController()->shelf_widget()->IsVisible() && | 199 if (!Shell::GetPrimaryRootWindowController()->shelf_widget()->IsVisible() && |
200 !nagger_.get()) { | 200 !nagger_.get()) { |
201 // The shelf is not visible, and there is no nagger scheduled. | 201 // The shelf is not visible, and there is no nagger scheduled. |
202 nagger_.reset(new tray::UpdateNagger(this)); | 202 nagger_.reset(new tray::UpdateNagger(this)); |
203 } | 203 } |
204 } | 204 } |
205 | 205 |
206 } // namespace ash | 206 } // namespace ash |
OLD | NEW |