Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(971)

Unified Diff: ash/system/update/tray_update.cc

Issue 2816253002: Display "Restart to update Adobe Flash Player" for Flash updates. (Closed)
Patch Set: Add test for Flash player update Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ash/system/update/tray_update.cc
diff --git a/ash/system/update/tray_update.cc b/ash/system/update/tray_update.cc
index 55a82c5649a29a7510b5637802f1ce406392c228..0419c9b41f2c5ca30b66f337bc04cfb44801326f 100644
--- a/ash/system/update/tray_update.cc
+++ b/ash/system/update/tray_update.cc
@@ -60,6 +60,8 @@ bool TrayUpdate::update_required_ = false;
mojom::UpdateSeverity TrayUpdate::severity_ = mojom::UpdateSeverity::NONE;
// static
bool TrayUpdate::factory_reset_required_ = false;
+mojom::UpdateType TrayUpdate::update_type_ = mojom::UpdateType::SYSTEM;
+views::Label* TrayUpdate::update_label_ = nullptr;
// The "restart to update" item in the system tray menu.
class TrayUpdate::UpdateView : public ActionableView {
@@ -77,14 +79,21 @@ class TrayUpdate::UpdateView : public ActionableView {
IconColorForUpdateSeverity(owner->severity_, true)));
tri_view->AddView(TriView::Container::START, image);
- base::string16 label_text =
- owner->factory_reset_required_
- ? bundle.GetLocalizedString(
- IDS_ASH_STATUS_TRAY_RESTART_AND_POWERWASH_TO_UPDATE)
- : bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE);
+ base::string16 label_text;
+ if (owner->factory_reset_required_) {
+ label_text = bundle.GetLocalizedString(
+ IDS_ASH_STATUS_TRAY_RESTART_AND_POWERWASH_TO_UPDATE);
+ } else if (owner->update_type_ == mojom::UpdateType::FLASH) {
+ label_text = bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE_FLASH);
+ } else {
+ label_text = bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE);
+ }
+
SetAccessibleName(label_text);
- auto* label = TrayPopupUtils::CreateDefaultLabel();
+ views::Label* label = TrayPopupUtils::CreateDefaultLabel();
label->SetText(label_text);
+ update_label_ = label;
James Cook 2017/04/18 23:20:57 update_label_ can point to deleted memory after th
Greg K 2017/04/18 23:45:23 Done.
+
TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL);
style.SetupLabel(label);
tri_view->AddView(TriView::Container::CENTER, label);
@@ -123,15 +132,21 @@ views::View* TrayUpdate::CreateDefaultView(LoginStatus status) {
}
void TrayUpdate::ShowUpdateIcon(mojom::UpdateSeverity severity,
- bool factory_reset_required) {
+ bool factory_reset_required,
+ mojom::UpdateType update_type) {
// Cache update info so we can create the default view when the menu opens.
update_required_ = true;
severity_ = severity;
factory_reset_required_ = factory_reset_required;
+ update_type_ = update_type;
// Show the icon in the tray.
SetIconColor(IconColorForUpdateSeverity(severity_, false));
tray_view()->SetVisible(true);
}
+base::string16 TrayUpdate::GetLabelForTesting() {
+ return update_label_ ? update_label_->text() : base::string16();
James Cook 2017/04/18 23:20:57 Then this could become "return default_view_ ? def
Greg K 2017/04/18 23:45:23 Done.
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698