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/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/status_area_widget.h" | 9 #include "ash/system/status_area_widget.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 : TrayImageItem(IDR_AURA_UBER_TRAY_UPDATE), | 157 : TrayImageItem(IDR_AURA_UBER_TRAY_UPDATE), |
158 severity_(UpdateObserver::UPDATE_NORMAL) { | 158 severity_(UpdateObserver::UPDATE_NORMAL) { |
159 } | 159 } |
160 | 160 |
161 TrayUpdate::~TrayUpdate() {} | 161 TrayUpdate::~TrayUpdate() {} |
162 | 162 |
163 bool TrayUpdate::GetInitialVisibility() { | 163 bool TrayUpdate::GetInitialVisibility() { |
164 return Shell::GetInstance()->tray_delegate()->SystemShouldUpgrade(); | 164 return Shell::GetInstance()->tray_delegate()->SystemShouldUpgrade(); |
165 } | 165 } |
166 | 166 |
167 views::View* TrayUpdate::CreateDefaultView(user::LoginStatus status) { | 167 views::View* TrayUpdate::CreateDefaultView(user::LoginStatus status, |
| 168 int bubble_width) { |
168 if (!Shell::GetInstance()->tray_delegate()->SystemShouldUpgrade()) | 169 if (!Shell::GetInstance()->tray_delegate()->SystemShouldUpgrade()) |
169 return NULL; | 170 return NULL; |
170 return new UpdateView(severity_); | 171 return new UpdateView(severity_); |
171 } | 172 } |
172 | 173 |
173 views::View* TrayUpdate::CreateDetailedView(user::LoginStatus status) { | 174 views::View* TrayUpdate::CreateDetailedView(user::LoginStatus status) { |
174 return CreateDefaultView(status); | 175 return CreateDefaultView(status, 0); |
175 } | 176 } |
176 | 177 |
177 void TrayUpdate::DestroyDetailedView() { | 178 void TrayUpdate::DestroyDetailedView() { |
178 if (nagger_.get()) { | 179 if (nagger_.get()) { |
179 // The nagger was being displayed. Now that the detailed view is being | 180 // The nagger was being displayed. Now that the detailed view is being |
180 // closed, that means either the user clicks on it to restart, or the user | 181 // closed, that means either the user clicks on it to restart, or the user |
181 // didn't click on it to restart. In either case, start the timer to show | 182 // didn't click on it to restart. In either case, start the timer to show |
182 // the nag reminder again after the specified time. | 183 // the nag reminder again after the specified time. |
183 nagger_->RestartTimer(); | 184 nagger_->RestartTimer(); |
184 } | 185 } |
185 } | 186 } |
186 | 187 |
187 void TrayUpdate::OnUpdateRecommended(UpdateObserver::UpdateSeverity severity) { | 188 void TrayUpdate::OnUpdateRecommended(UpdateObserver::UpdateSeverity severity) { |
188 severity_ = severity; | 189 severity_ = severity; |
189 SetImageFromResourceId(DecideResource(severity_, false)); | 190 SetImageFromResourceId(DecideResource(severity_, false)); |
190 tray_view()->SetVisible(true); | 191 tray_view()->SetVisible(true); |
191 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && | 192 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && |
192 !nagger_.get()) { | 193 !nagger_.get()) { |
193 // The shelf is not visible, and there is no nagger scheduled. | 194 // The shelf is not visible, and there is no nagger scheduled. |
194 nagger_.reset(new tray::UpdateNagger(this)); | 195 nagger_.reset(new tray::UpdateNagger(this)); |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
198 } // namespace internal | 199 } // namespace internal |
199 } // namespace ash | 200 } // namespace ash |
OLD | NEW |