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/system/tray_update.h" | 5 #include "ash/system/tray_update.h" |
6 | 6 |
7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/system/status_area_widget.h" | 9 #include "ash/system/status_area_widget.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 namespace ash { | 95 namespace ash { |
96 namespace internal { | 96 namespace internal { |
97 | 97 |
98 namespace tray { | 98 namespace tray { |
99 | 99 |
100 class UpdateNagger : public ui::LayerAnimationObserver { | 100 class UpdateNagger : public ui::LayerAnimationObserver { |
101 public: | 101 public: |
102 explicit UpdateNagger(SystemTrayItem* owner) | 102 explicit UpdateNagger(SystemTrayItem* owner) |
103 : owner_(owner) { | 103 : owner_(owner) { |
104 RestartTimer(); | 104 RestartTimer(); |
105 Shell::GetInstance()->system_tray()->GetWidget()->GetNativeView()->layer()-> | 105 owner_->system_tray()->GetWidget()->GetNativeView()->layer()-> |
106 GetAnimator()->AddObserver(this); | 106 GetAnimator()->AddObserver(this); |
107 } | 107 } |
108 | 108 |
109 virtual ~UpdateNagger() { | 109 virtual ~UpdateNagger() { |
110 internal::StatusAreaWidget* status_area = | 110 internal::StatusAreaWidget* status_area = |
111 ash::Shell::GetInstance()->status_area_widget(); | 111 ash::Shell::GetInstance()->status_area_widget(); |
112 if (status_area) { | 112 if (status_area) { |
113 status_area->system_tray()->GetWidget()->GetNativeView()->layer()-> | 113 status_area->system_tray()->GetWidget()->GetNativeView()->layer()-> |
114 GetAnimator()->RemoveObserver(this); | 114 GetAnimator()->RemoveObserver(this); |
115 } | 115 } |
(...skipping 30 matching lines...) Expand all Loading... |
146 ui::LayerAnimationSequence* sequence) OVERRIDE {} | 146 ui::LayerAnimationSequence* sequence) OVERRIDE {} |
147 | 147 |
148 SystemTrayItem* owner_; | 148 SystemTrayItem* owner_; |
149 base::OneShotTimer<UpdateNagger> timer_; | 149 base::OneShotTimer<UpdateNagger> timer_; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(UpdateNagger); | 151 DISALLOW_COPY_AND_ASSIGN(UpdateNagger); |
152 }; | 152 }; |
153 | 153 |
154 } // namespace tray | 154 } // namespace tray |
155 | 155 |
156 TrayUpdate::TrayUpdate() | 156 TrayUpdate::TrayUpdate(SystemTray* system_tray) |
157 : TrayImageItem(IDR_AURA_UBER_TRAY_UPDATE), | 157 : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE), |
158 severity_(UpdateObserver::UPDATE_NORMAL) { | 158 severity_(UpdateObserver::UPDATE_NORMAL) { |
159 } | 159 } |
160 | 160 |
161 TrayUpdate::~TrayUpdate() {} | 161 TrayUpdate::~TrayUpdate() {} |
162 | 162 |
163 bool TrayUpdate::GetInitialVisibility() { | 163 bool TrayUpdate::GetInitialVisibility() { |
164 return Shell::GetInstance()->tray_delegate()->SystemShouldUpgrade(); | 164 return Shell::GetInstance()->tray_delegate()->SystemShouldUpgrade(); |
165 } | 165 } |
166 | 166 |
167 views::View* TrayUpdate::CreateDefaultView(user::LoginStatus status) { | 167 views::View* TrayUpdate::CreateDefaultView(user::LoginStatus status) { |
(...skipping 22 matching lines...) Expand all Loading... |
190 tray_view()->SetVisible(true); | 190 tray_view()->SetVisible(true); |
191 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && | 191 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && |
192 !nagger_.get()) { | 192 !nagger_.get()) { |
193 // The shelf is not visible, and there is no nagger scheduled. | 193 // The shelf is not visible, and there is no nagger scheduled. |
194 nagger_.reset(new tray::UpdateNagger(this)); | 194 nagger_.reset(new tray::UpdateNagger(this)); |
195 } | 195 } |
196 } | 196 } |
197 | 197 |
198 } // namespace internal | 198 } // namespace internal |
199 } // namespace ash | 199 } // namespace ash |
OLD | NEW |