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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 owner_->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 Shell::GetPrimaryRootWindowController()->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 } |
116 } | 116 } |
117 | 117 |
118 void RestartTimer() { | 118 void RestartTimer() { |
119 timer_.Stop(); | 119 timer_.Stop(); |
120 timer_.Start(FROM_HERE, | 120 timer_.Start(FROM_HERE, |
121 base::TimeDelta::FromSeconds(kUpdateNaggingTimeSeconds), | 121 base::TimeDelta::FromSeconds(kUpdateNaggingTimeSeconds), |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |