| 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/common/system/tray/system_tray_item.h" | 5 #include "ash/common/system/tray/system_tray_item.h" |
| 6 | 6 |
| 7 #include "ash/common/system/tray/system_tray.h" | 7 #include "ash/common/system/tray/system_tray.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" |
| 10 #include "base/timer/timer.h" |
| 9 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
| 10 | 12 |
| 11 namespace ash { | 13 namespace ash { |
| 12 | 14 |
| 13 SystemTrayItem::SystemTrayItem(SystemTray* system_tray, UmaType uma_type) | 15 SystemTrayItem::SystemTrayItem(SystemTray* system_tray, UmaType uma_type) |
| 14 : system_tray_(system_tray), uma_type_(uma_type), restore_focus_(false) {} | 16 : system_tray_(system_tray), uma_type_(uma_type), restore_focus_(false) {} |
| 15 | 17 |
| 16 SystemTrayItem::~SystemTrayItem() {} | 18 SystemTrayItem::~SystemTrayItem() {} |
| 17 | 19 |
| 18 views::View* SystemTrayItem::CreateTrayView(LoginStatus status) { | 20 views::View* SystemTrayItem::CreateTrayView(LoginStatus status) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 33 | 35 |
| 34 void SystemTrayItem::DestroyTrayView() {} | 36 void SystemTrayItem::DestroyTrayView() {} |
| 35 | 37 |
| 36 void SystemTrayItem::DestroyDefaultView() {} | 38 void SystemTrayItem::DestroyDefaultView() {} |
| 37 | 39 |
| 38 void SystemTrayItem::DestroyDetailedView() {} | 40 void SystemTrayItem::DestroyDetailedView() {} |
| 39 | 41 |
| 40 void SystemTrayItem::DestroyNotificationView() {} | 42 void SystemTrayItem::DestroyNotificationView() {} |
| 41 | 43 |
| 42 void SystemTrayItem::TransitionDetailedView() { | 44 void SystemTrayItem::TransitionDetailedView() { |
| 43 system_tray()->ShowDetailedView(this, 0, true, BUBBLE_USE_EXISTING); | 45 const int transition_delay = |
| 46 GetTrayConstant(TRAY_POPUP_TRANSITION_TO_DETAILED_DELAY); |
| 47 if (transition_delay <= 0) { |
| 48 DoTransitionToDetailedView(); |
| 49 return; |
| 50 } |
| 51 transition_delay_timer_.reset(new base::OneShotTimer()); |
| 52 transition_delay_timer_->Start( |
| 53 FROM_HERE, base::TimeDelta::FromMilliseconds(transition_delay), this, |
| 54 &SystemTrayItem::DoTransitionToDetailedView); |
| 44 } | 55 } |
| 45 | 56 |
| 46 void SystemTrayItem::UpdateAfterLoginStatusChange(LoginStatus status) {} | 57 void SystemTrayItem::UpdateAfterLoginStatusChange(LoginStatus status) {} |
| 47 | 58 |
| 48 void SystemTrayItem::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { | 59 void SystemTrayItem::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { |
| 49 } | 60 } |
| 50 | 61 |
| 51 void SystemTrayItem::PopupDetailedView(int for_seconds, bool activate) { | 62 void SystemTrayItem::PopupDetailedView(int for_seconds, bool activate) { |
| 52 system_tray()->ShowDetailedView(this, for_seconds, activate, | 63 system_tray()->ShowDetailedView(this, for_seconds, activate, |
| 53 BUBBLE_CREATE_NEW); | 64 BUBBLE_CREATE_NEW); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 66 } | 77 } |
| 67 | 78 |
| 68 void SystemTrayItem::HideNotificationView() { | 79 void SystemTrayItem::HideNotificationView() { |
| 69 system_tray()->HideNotificationView(this); | 80 system_tray()->HideNotificationView(this); |
| 70 } | 81 } |
| 71 | 82 |
| 72 bool SystemTrayItem::ShouldShowShelf() const { | 83 bool SystemTrayItem::ShouldShowShelf() const { |
| 73 return true; | 84 return true; |
| 74 } | 85 } |
| 75 | 86 |
| 87 void SystemTrayItem::DoTransitionToDetailedView() { |
| 88 transition_delay_timer_.reset(); |
| 89 system_tray()->ShowDetailedView(this, 0, true, BUBBLE_USE_EXISTING); |
| 90 } |
| 91 |
| 76 } // namespace ash | 92 } // namespace ash |
| OLD | NEW |