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

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

Issue 2933923002: Remove update icon after user confirms download (Closed)
Patch Set: Created 3 years, 6 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 5a1058a9ee7617fd3a4d6aa4662857ec551a43be..7eb1e3c8a8b801449b0ee88bfa658b73f781476e 100644
--- a/ash/system/update/tray_update.cc
+++ b/ash/system/update/tray_update.cc
@@ -14,6 +14,7 @@
#include "ash/system/tray/system_tray.h"
#include "ash/system/tray/system_tray_controller.h"
#include "ash/system/tray/system_tray_delegate.h"
+#include "ash/system/tray/system_tray_notifier.h"
#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_popup_item_style.h"
#include "ash/system/tray/tray_popup_utils.h"
@@ -24,6 +25,7 @@
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/layout/fill_layout.h"
+#include "ui/views/widget/widget.h"
namespace ash {
namespace {
@@ -137,9 +139,13 @@ class TrayUpdate::UpdateView : public ActionableView {
};
TrayUpdate::TrayUpdate(SystemTray* system_tray)
- : TrayImageItem(system_tray, kSystemTrayUpdateIcon, UMA_UPDATE) {}
+ : TrayImageItem(system_tray, kSystemTrayUpdateIcon, UMA_UPDATE) {
+ Shell::Get()->system_tray_notifier()->AddUpdateObserver(this);
+}
-TrayUpdate::~TrayUpdate() {}
+TrayUpdate::~TrayUpdate() {
+ Shell::Get()->system_tray_notifier()->RemoveUpdateObserver(this);
+}
bool TrayUpdate::GetInitialVisibility() {
// If chrome tells ash there is an update available before this item's system
@@ -159,6 +165,15 @@ void TrayUpdate::OnDefaultViewDestroyed() {
update_view_ = nullptr;
}
+void TrayUpdate::OnUpdateOverCellularTargetSet(bool success) {
+ if (success) {
stevenjb 2017/06/13 17:38:18 if (!success) return;
weidongg 2017/06/13 19:01:39 Done.
+ tray_view()->SetVisible(false);
+ update_over_cellular_available_ = false;
+ if (update_view_)
+ update_view_->GetWidget()->Close();
+ }
+}
+
void TrayUpdate::ShowUpdateIcon(mojom::UpdateSeverity severity,
bool factory_reset_required,
mojom::UpdateType update_type) {

Powered by Google App Engine
This is Rietveld 408576698