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

Side by Side Diff: ash/common/system/update/tray_update.cc

Issue 2162153002: Added Ash.SystemMenu.DefaultView.VisibleItems histogram. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed ash_unittests compile errors. Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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/common/system/update/tray_update.h" 5 #include "ash/common/system/update/tray_update.h"
6 6
7 #include "ash/common/metrics/user_metrics_action.h" 7 #include "ash/common/metrics/user_metrics_action.h"
8 #include "ash/common/system/tray/fixed_sized_image_view.h" 8 #include "ash/common/system/tray/fixed_sized_image_view.h"
9 #include "ash/common/system/tray/system_tray.h" 9 #include "ash/common/system/tray/system_tray.h"
10 #include "ash/common/system/tray/system_tray_delegate.h" 10 #include "ash/common/system/tray/system_tray_delegate.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 UMA_STATUS_AREA_OS_UPDATE_DEFAULT_SELECTED); 79 UMA_STATUS_AREA_OS_UPDATE_DEFAULT_SELECTED);
80 return true; 80 return true;
81 } 81 }
82 82
83 DISALLOW_COPY_AND_ASSIGN(UpdateView); 83 DISALLOW_COPY_AND_ASSIGN(UpdateView);
84 }; 84 };
85 85
86 } // namespace 86 } // namespace
87 87
88 TrayUpdate::TrayUpdate(SystemTray* system_tray) 88 TrayUpdate::TrayUpdate(SystemTray* system_tray)
89 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE) { 89 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE, OS_UPDATE) {
tdanderson 2016/07/19 21:58:40 Just UPDATE?
bruthig 2016/07/20 18:15:52 Done.
90 WmShell::Get()->system_tray_notifier()->AddUpdateObserver(this); 90 WmShell::Get()->system_tray_notifier()->AddUpdateObserver(this);
91 } 91 }
92 92
93 TrayUpdate::~TrayUpdate() { 93 TrayUpdate::~TrayUpdate() {
94 WmShell::Get()->system_tray_notifier()->RemoveUpdateObserver(this); 94 WmShell::Get()->system_tray_notifier()->RemoveUpdateObserver(this);
95 } 95 }
96 96
97 bool TrayUpdate::GetInitialVisibility() { 97 bool TrayUpdate::GetInitialVisibility() {
98 UpdateInfo info; 98 UpdateInfo info;
99 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); 99 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info);
100 return info.update_required; 100 return info.update_required;
101 } 101 }
102 102
103 views::View* TrayUpdate::CreateDefaultView(LoginStatus status) { 103 views::View* TrayUpdate::CreateDefaultView(LoginStatus status) {
104 UpdateInfo info; 104 UpdateInfo info;
105 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); 105 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info);
106 return info.update_required ? new UpdateView(info) : nullptr; 106 return info.update_required ? new UpdateView(info) : nullptr;
107 } 107 }
108 108
109 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { 109 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) {
110 SetImageFromResourceId(DecideResource(info.severity, false)); 110 SetImageFromResourceId(DecideResource(info.severity, false));
111 tray_view()->SetVisible(true); 111 tray_view()->SetVisible(true);
112 } 112 }
113 113
114 } // namespace ash 114 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698