| 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/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shelf/shelf_widget.h" |
| 8 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 9 #include "ash/system/status_area_widget.h" | 11 #include "ash/system/status_area_widget.h" |
| 10 #include "ash/system/tray/fixed_sized_image_view.h" | 12 #include "ash/system/tray/fixed_sized_image_view.h" |
| 11 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
| 12 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
| 13 #include "ash/system/tray/system_tray_notifier.h" | 15 #include "ash/system/tray/system_tray_notifier.h" |
| 14 #include "ash/system/tray/tray_constants.h" | 16 #include "ash/system/tray/tray_constants.h" |
| 15 #include "ash/system/tray/tray_views.h" | 17 #include "ash/system/tray/tray_views.h" |
| 16 #include "ash/wm/shelf_layout_manager.h" | |
| 17 #include "base/time.h" | 18 #include "base/time.h" |
| 18 #include "base/timer.h" | 19 #include "base/timer.h" |
| 19 #include "grit/ash_resources.h" | 20 #include "grit/ash_resources.h" |
| 20 #include "grit/ash_strings.h" | 21 #include "grit/ash_strings.h" |
| 21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 22 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 23 #include "ui/compositor/layer.h" | 24 #include "ui/compositor/layer.h" |
| 24 #include "ui/compositor/layer_animation_observer.h" | 25 #include "ui/compositor/layer_animation_observer.h" |
| 25 #include "ui/compositor/layer_animation_sequence.h" | 26 #include "ui/compositor/layer_animation_sequence.h" |
| 26 #include "ui/gfx/image/image.h" | 27 #include "ui/gfx/image/image.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 public: | 104 public: |
| 104 explicit UpdateNagger(SystemTrayItem* owner) | 105 explicit UpdateNagger(SystemTrayItem* owner) |
| 105 : owner_(owner) { | 106 : owner_(owner) { |
| 106 RestartTimer(); | 107 RestartTimer(); |
| 107 owner_->system_tray()->GetWidget()->GetNativeView()->layer()-> | 108 owner_->system_tray()->GetWidget()->GetNativeView()->layer()-> |
| 108 GetAnimator()->AddObserver(this); | 109 GetAnimator()->AddObserver(this); |
| 109 } | 110 } |
| 110 | 111 |
| 111 virtual ~UpdateNagger() { | 112 virtual ~UpdateNagger() { |
| 112 internal::StatusAreaWidget* status_area = | 113 internal::StatusAreaWidget* status_area = |
| 113 Shell::GetPrimaryRootWindowController()->status_area_widget(); | 114 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); |
| 114 if (status_area) { | 115 if (status_area) { |
| 115 status_area->system_tray()->GetWidget()->GetNativeView()->layer()-> | 116 status_area->system_tray()->GetWidget()->GetNativeView()->layer()-> |
| 116 GetAnimator()->RemoveObserver(this); | 117 GetAnimator()->RemoveObserver(this); |
| 117 } | 118 } |
| 118 } | 119 } |
| 119 | 120 |
| 120 void RestartTimer() { | 121 void RestartTimer() { |
| 121 timer_.Stop(); | 122 timer_.Stop(); |
| 122 timer_.Start(FROM_HERE, | 123 timer_.Start(FROM_HERE, |
| 123 base::TimeDelta::FromSeconds(kUpdateNaggingTimeSeconds), | 124 base::TimeDelta::FromSeconds(kUpdateNaggingTimeSeconds), |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 tray_view()->SetVisible(true); | 196 tray_view()->SetVisible(true); |
| 196 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && | 197 if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() && |
| 197 !nagger_.get()) { | 198 !nagger_.get()) { |
| 198 // The shelf is not visible, and there is no nagger scheduled. | 199 // The shelf is not visible, and there is no nagger scheduled. |
| 199 nagger_.reset(new tray::UpdateNagger(this)); | 200 nagger_.reset(new tray::UpdateNagger(this)); |
| 200 } | 201 } |
| 201 } | 202 } |
| 202 | 203 |
| 203 } // namespace internal | 204 } // namespace internal |
| 204 } // namespace ash | 205 } // namespace ash |
| OLD | NEW |