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

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

Issue 2059383002: mash: Move TrayUpdate to //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ashconstants
Patch Set: rebase Created 4 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 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/system/tray_update.h" 5 #include "ash/common/system/update/tray_update.h"
6 6
7 #include "ash/common/system/tray/fixed_sized_image_view.h" 7 #include "ash/common/system/tray/fixed_sized_image_view.h"
8 #include "ash/common/system/tray/system_tray_delegate.h" 8 #include "ash/common/system/tray/system_tray_delegate.h"
9 #include "ash/common/system/tray/tray_constants.h" 9 #include "ash/common/system/tray/tray_constants.h"
10 #include "ash/common/system/tray/wm_system_tray_notifier.h" 10 #include "ash/common/system/tray/wm_system_tray_notifier.h"
11 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
12 #include "ash/system/tray/system_tray.h" 12 #include "ash/system/tray/system_tray.h"
13 #include "grit/ash_resources.h" 13 #include "grit/ash_resources.h"
14 #include "grit/ash_strings.h" 14 #include "grit/ash_strings.h"
15 #include "ui/aura/window.h"
16 #include "ui/base/resource/resource_bundle.h" 15 #include "ui/base/resource/resource_bundle.h"
17 #include "ui/gfx/image/image.h" 16 #include "ui/gfx/image/image.h"
18 #include "ui/views/controls/image_view.h" 17 #include "ui/views/controls/image_view.h"
19 #include "ui/views/controls/label.h" 18 #include "ui/views/controls/label.h"
20 #include "ui/views/layout/box_layout.h" 19 #include "ui/views/layout/box_layout.h"
21 #include "ui/views/widget/widget.h"
22 20
23 namespace { 21 namespace {
24 22
25 int DecideResource(ash::UpdateInfo::UpdateSeverity severity, bool dark) { 23 int DecideResource(ash::UpdateInfo::UpdateSeverity severity, bool dark) {
26 switch (severity) { 24 switch (severity) {
27 case ash::UpdateInfo::UPDATE_NORMAL: 25 case ash::UpdateInfo::UPDATE_NORMAL:
28 return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK: 26 return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK:
29 IDR_AURA_UBER_TRAY_UPDATE; 27 IDR_AURA_UBER_TRAY_UPDATE;
30 28
31 case ash::UpdateInfo::UPDATE_LOW_GREEN: 29 case ash::UpdateInfo::UPDATE_LOW_GREEN:
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); 104 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info);
107 return info.update_required ? new UpdateView(info) : nullptr; 105 return info.update_required ? new UpdateView(info) : nullptr;
108 } 106 }
109 107
110 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { 108 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) {
111 SetImageFromResourceId(DecideResource(info.severity, false)); 109 SetImageFromResourceId(DecideResource(info.severity, false));
112 tray_view()->SetVisible(true); 110 tray_view()->SetVisible(true);
113 } 111 }
114 112
115 } // namespace ash 113 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/update/tray_update.h ('k') | ash/common/system/update/tray_update_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698