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/tray_notification_view.h" | 5 #include "ash/system/tray/tray_notification_view.h" |
6 | 6 |
7 #include "ash/system/tray/system_tray_item.h" | 7 #include "ash/system/tray/system_tray_item.h" |
8 #include "ash/system/tray/tray_constants.h" | 8 #include "ash/system/tray/tray_constants.h" |
9 #include "grit/ash_strings.h" | 9 #include "grit/ash_strings.h" |
10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void TrayNotificationView::UpdateViewAndImage(views::View* new_contents, | 101 void TrayNotificationView::UpdateViewAndImage(views::View* new_contents, |
102 const gfx::ImageSkia& image) { | 102 const gfx::ImageSkia& image) { |
103 RemoveAllChildViews(true); | 103 RemoveAllChildViews(true); |
104 InitView(new_contents); | 104 InitView(new_contents); |
105 icon_->SetImage(image); | 105 icon_->SetImage(image); |
106 Layout(); | 106 Layout(); |
107 PreferredSizeChanged(); | 107 PreferredSizeChanged(); |
108 SchedulePaint(); | 108 SchedulePaint(); |
109 } | 109 } |
110 | 110 |
| 111 void TrayNotificationView::StartAutoCloseTimer(int seconds) { |
| 112 autoclose_.Stop(); |
| 113 autoclose_delay_ = seconds; |
| 114 if (autoclose_delay_) { |
| 115 autoclose_.Start(FROM_HERE, |
| 116 base::TimeDelta::FromSeconds(autoclose_delay_), |
| 117 this, &TrayNotificationView::HandleClose); |
| 118 } |
| 119 } |
| 120 |
| 121 void TrayNotificationView::StopAutoCloseTimer() { |
| 122 autoclose_.Stop(); |
| 123 } |
| 124 |
| 125 void TrayNotificationView::RestartAutoCloseTimer() { |
| 126 if (autoclose_delay_) |
| 127 StartAutoCloseTimer(autoclose_delay_); |
| 128 } |
| 129 |
111 void TrayNotificationView::ButtonPressed(views::Button* sender, | 130 void TrayNotificationView::ButtonPressed(views::Button* sender, |
112 const ui::Event& event) { | 131 const ui::Event& event) { |
113 HandleClose(); | 132 HandleClose(); |
114 } | 133 } |
115 | 134 |
116 bool TrayNotificationView::OnMousePressed(const ui::MouseEvent& event) { | 135 bool TrayNotificationView::OnMousePressed(const ui::MouseEvent& event) { |
117 HandleClickAction(); | 136 HandleClickAction(); |
118 return true; | 137 return true; |
119 } | 138 } |
120 | 139 |
(...skipping 22 matching lines...) Expand all Loading... |
143 owner_->HideNotificationView(); | 162 owner_->HideNotificationView(); |
144 } | 163 } |
145 | 164 |
146 void TrayNotificationView::HandleClickAction() { | 165 void TrayNotificationView::HandleClickAction() { |
147 HandleClose(); | 166 HandleClose(); |
148 OnClickAction(); | 167 OnClickAction(); |
149 } | 168 } |
150 | 169 |
151 } // namespace internal | 170 } // namespace internal |
152 } // namespace ash | 171 } // namespace ash |
OLD | NEW |