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/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_delegate.h" | 9 #include "ash/common/system/tray/system_tray_delegate.h" |
10 #include "ash/common/system/tray/system_tray_notifier.h" | 10 #include "ash/common/system/tray/system_tray_notifier.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 return true; | 78 return true; |
79 } | 79 } |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(UpdateView); | 81 DISALLOW_COPY_AND_ASSIGN(UpdateView); |
82 }; | 82 }; |
83 } | 83 } |
84 | 84 |
85 namespace ash { | 85 namespace ash { |
86 | 86 |
87 TrayUpdate::TrayUpdate(SystemTray* system_tray) | 87 TrayUpdate::TrayUpdate(SystemTray* system_tray) |
88 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE) { | 88 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE, UMA_UPDATE) { |
89 WmShell::Get()->system_tray_notifier()->AddUpdateObserver(this); | 89 WmShell::Get()->system_tray_notifier()->AddUpdateObserver(this); |
90 } | 90 } |
91 | 91 |
92 TrayUpdate::~TrayUpdate() { | 92 TrayUpdate::~TrayUpdate() { |
93 WmShell::Get()->system_tray_notifier()->RemoveUpdateObserver(this); | 93 WmShell::Get()->system_tray_notifier()->RemoveUpdateObserver(this); |
94 } | 94 } |
95 | 95 |
96 bool TrayUpdate::GetInitialVisibility() { | 96 bool TrayUpdate::GetInitialVisibility() { |
97 UpdateInfo info; | 97 UpdateInfo info; |
98 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); | 98 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); |
99 return info.update_required; | 99 return info.update_required; |
100 } | 100 } |
101 | 101 |
102 views::View* TrayUpdate::CreateDefaultView(LoginStatus status) { | 102 views::View* TrayUpdate::CreateDefaultView(LoginStatus status) { |
103 UpdateInfo info; | 103 UpdateInfo info; |
104 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); | 104 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); |
105 return info.update_required ? new UpdateView(info) : nullptr; | 105 return info.update_required ? new UpdateView(info) : nullptr; |
106 } | 106 } |
107 | 107 |
108 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { | 108 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { |
109 SetImageFromResourceId(DecideResource(info.severity, false)); | 109 SetImageFromResourceId(DecideResource(info.severity, false)); |
110 tray_view()->SetVisible(true); | 110 tray_view()->SetVisible(true); |
111 } | 111 } |
112 | 112 |
113 } // namespace ash | 113 } // namespace ash |
OLD | NEW |