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

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

Issue 2060633002: mash: Introduce WmSystemTrayNotifier for //ash/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@testupdate
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
« no previous file with comments | « ash/system/tray/system_tray_notifier.cc ('k') | ash/system/tray_update_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/system/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/wm_shell.h" 11 #include "ash/common/wm_shell.h"
11 #include "ash/shell.h"
12 #include "ash/system/tray/system_tray.h" 12 #include "ash/system/tray/system_tray.h"
13 #include "ash/system/tray/system_tray_notifier.h"
14 #include "grit/ash_resources.h" 13 #include "grit/ash_resources.h"
15 #include "grit/ash_strings.h" 14 #include "grit/ash_strings.h"
16 #include "ui/aura/window.h" 15 #include "ui/aura/window.h"
17 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
18 #include "ui/gfx/image/image.h" 17 #include "ui/gfx/image/image.h"
19 #include "ui/views/controls/image_view.h" 18 #include "ui/views/controls/image_view.h"
20 #include "ui/views/controls/label.h" 19 #include "ui/views/controls/label.h"
21 #include "ui/views/layout/box_layout.h" 20 #include "ui/views/layout/box_layout.h"
22 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
23 22
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 81
83 DISALLOW_COPY_AND_ASSIGN(UpdateView); 82 DISALLOW_COPY_AND_ASSIGN(UpdateView);
84 }; 83 };
85 84
86 } 85 }
87 86
88 namespace ash { 87 namespace ash {
89 88
90 TrayUpdate::TrayUpdate(SystemTray* system_tray) 89 TrayUpdate::TrayUpdate(SystemTray* system_tray)
91 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE) { 90 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE) {
92 Shell::GetInstance()->system_tray_notifier()->AddUpdateObserver(this); 91 WmShell::Get()->system_tray_notifier()->AddUpdateObserver(this);
93 } 92 }
94 93
95 TrayUpdate::~TrayUpdate() { 94 TrayUpdate::~TrayUpdate() {
96 Shell::GetInstance()->system_tray_notifier()->RemoveUpdateObserver(this); 95 WmShell::Get()->system_tray_notifier()->RemoveUpdateObserver(this);
97 } 96 }
98 97
99 bool TrayUpdate::GetInitialVisibility() { 98 bool TrayUpdate::GetInitialVisibility() {
100 UpdateInfo info; 99 UpdateInfo info;
101 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); 100 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info);
102 return info.update_required; 101 return info.update_required;
103 } 102 }
104 103
105 views::View* TrayUpdate::CreateDefaultView(LoginStatus status) { 104 views::View* TrayUpdate::CreateDefaultView(LoginStatus status) {
106 UpdateInfo info; 105 UpdateInfo info;
107 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info); 106 WmShell::Get()->system_tray_delegate()->GetSystemUpdateInfo(&info);
108 return info.update_required ? new UpdateView(info) : nullptr; 107 return info.update_required ? new UpdateView(info) : nullptr;
109 } 108 }
110 109
111 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) { 110 void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) {
112 SetImageFromResourceId(DecideResource(info.severity, false)); 111 SetImageFromResourceId(DecideResource(info.severity, false));
113 tray_view()->SetVisible(true); 112 tray_view()->SetVisible(true);
114 } 113 }
115 114
116 } // namespace ash 115 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/tray/system_tray_notifier.cc ('k') | ash/system/tray_update_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698