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/system/tray/fixed_sized_image_view.h" | 8 #include "ash/common/system/tray/fixed_sized_image_view.h" |
8 #include "ash/common/system/tray/system_tray_delegate.h" | 9 #include "ash/common/system/tray/system_tray_delegate.h" |
9 #include "ash/common/system/tray/system_tray_notifier.h" | 10 #include "ash/common/system/tray/system_tray_notifier.h" |
10 #include "ash/common/system/tray/tray_constants.h" | 11 #include "ash/common/system/tray/tray_constants.h" |
11 #include "ash/common/wm_shell.h" | 12 #include "ash/common/wm_shell.h" |
12 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
13 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
14 #include "grit/ash_strings.h" | 15 #include "grit/ash_strings.h" |
15 #include "ui/base/resource/resource_bundle.h" | 16 #include "ui/base/resource/resource_bundle.h" |
16 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 AddChildView(new views::Label(label)); | 68 AddChildView(new views::Label(label)); |
68 SetAccessibleName(label); | 69 SetAccessibleName(label); |
69 } | 70 } |
70 | 71 |
71 ~UpdateView() override {} | 72 ~UpdateView() override {} |
72 | 73 |
73 private: | 74 private: |
74 // Overridden from ActionableView. | 75 // Overridden from ActionableView. |
75 bool PerformAction(const ui::Event& event) override { | 76 bool PerformAction(const ui::Event& event) override { |
76 WmShell::Get()->system_tray_delegate()->RequestRestartForUpdate(); | 77 WmShell::Get()->system_tray_delegate()->RequestRestartForUpdate(); |
| 78 WmShell::Get()->RecordUserMetricsAction( |
| 79 UMA_STATUS_AREA_OS_UPDATE_DEFAULT_SELECTED); |
77 return true; | 80 return true; |
78 } | 81 } |
79 | 82 |
80 DISALLOW_COPY_AND_ASSIGN(UpdateView); | 83 DISALLOW_COPY_AND_ASSIGN(UpdateView); |
81 }; | 84 }; |
82 | 85 |
83 } // namespace | 86 } // namespace |
84 | 87 |
85 TrayUpdate::TrayUpdate(SystemTray* system_tray) | 88 TrayUpdate::TrayUpdate(SystemTray* system_tray) |
86 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE) { | 89 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE) { |
(...skipping 15 matching lines...) Expand all Loading... |
102 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); | 105 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); |
103 return info.update_required ? new UpdateView(info) : nullptr; | 106 return info.update_required ? new UpdateView(info) : nullptr; |
104 } | 107 } |
105 | 108 |
106 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { | 109 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { |
107 SetImageFromResourceId(DecideResource(info.severity, false)); | 110 SetImageFromResourceId(DecideResource(info.severity, false)); |
108 tray_view()->SetVisible(true); | 111 tray_view()->SetVisible(true); |
109 } | 112 } |
110 | 113 |
111 } // namespace ash | 114 } // namespace ash |
OLD | NEW |