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/chromeos/network/tray_sms.h" | 5 #include "ash/system/chromeos/network/tray_sms.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/fixed_sized_scroll_view.h" | 8 #include "ash/system/tray/fixed_sized_scroll_view.h" |
9 #include "ash/system/tray/system_tray.h" | 9 #include "ash/system/tray/system_tray.h" |
10 #include "ash/system/tray/system_tray_bubble.h" | 10 #include "ash/system/tray/system_tray_bubble.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 LayoutDetailedView(); | 108 LayoutDetailedView(); |
109 else | 109 else |
110 LayoutNotificationView(); | 110 LayoutNotificationView(); |
111 } | 111 } |
112 | 112 |
113 virtual ~SmsMessageView() { | 113 virtual ~SmsMessageView() { |
114 } | 114 } |
115 | 115 |
116 // Overridden from ButtonListener. | 116 // Overridden from ButtonListener. |
117 virtual void ButtonPressed(views::Button* sender, | 117 virtual void ButtonPressed(views::Button* sender, |
118 const ui::Event& event) OVERRIDE { | 118 const ui::Event& event) override { |
119 owner_->RemoveMessage(index_); | 119 owner_->RemoveMessage(index_); |
120 owner_->Update(false); | 120 owner_->Update(false); |
121 } | 121 } |
122 | 122 |
123 private: | 123 private: |
124 void LayoutDetailedView() { | 124 void LayoutDetailedView() { |
125 views::ImageButton* close_button = new views::ImageButton(this); | 125 views::ImageButton* close_button = new views::ImageButton(this); |
126 close_button->SetImage( | 126 close_button->SetImage( |
127 views::CustomButton::STATE_NORMAL, | 127 views::CustomButton::STATE_NORMAL, |
128 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 128 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 CreateSpecialRow(IDS_ASH_STATUS_TRAY_SMS, this); | 193 CreateSpecialRow(IDS_ASH_STATUS_TRAY_SMS, this); |
194 } | 194 } |
195 | 195 |
196 void Update() { | 196 void Update() { |
197 UpdateMessageList(); | 197 UpdateMessageList(); |
198 Layout(); | 198 Layout(); |
199 SchedulePaint(); | 199 SchedulePaint(); |
200 } | 200 } |
201 | 201 |
202 // Overridden from views::View. | 202 // Overridden from views::View. |
203 virtual gfx::Size GetPreferredSize() const OVERRIDE { | 203 virtual gfx::Size GetPreferredSize() const override { |
204 gfx::Size preferred_size = TrayDetailsView::GetPreferredSize(); | 204 gfx::Size preferred_size = TrayDetailsView::GetPreferredSize(); |
205 if (preferred_size.height() < kMessageListMinHeight) | 205 if (preferred_size.height() < kMessageListMinHeight) |
206 preferred_size.set_height(kMessageListMinHeight); | 206 preferred_size.set_height(kMessageListMinHeight); |
207 return preferred_size; | 207 return preferred_size; |
208 } | 208 } |
209 | 209 |
210 private: | 210 private: |
211 void UpdateMessageList() { | 211 void UpdateMessageList() { |
212 const base::ListValue& messages = | 212 const base::ListValue& messages = |
213 static_cast<TraySms*>(owner())->messages(); | 213 static_cast<TraySms*>(owner())->messages(); |
(...skipping 11 matching lines...) Expand all Loading... |
225 } | 225 } |
226 SmsMessageView* msgview = new SmsMessageView( | 226 SmsMessageView* msgview = new SmsMessageView( |
227 static_cast<TraySms*>(owner()), SmsMessageView::VIEW_DETAILED, index, | 227 static_cast<TraySms*>(owner()), SmsMessageView::VIEW_DETAILED, index, |
228 number, text); | 228 number, text); |
229 scroll_content()->AddChildView(msgview); | 229 scroll_content()->AddChildView(msgview); |
230 } | 230 } |
231 scroller()->Layout(); | 231 scroller()->Layout(); |
232 } | 232 } |
233 | 233 |
234 // Overridden from ViewClickListener. | 234 // Overridden from ViewClickListener. |
235 virtual void OnViewClicked(views::View* sender) OVERRIDE { | 235 virtual void OnViewClicked(views::View* sender) override { |
236 if (sender == footer()->content()) | 236 if (sender == footer()->content()) |
237 TransitionToDefaultView(); | 237 TransitionToDefaultView(); |
238 } | 238 } |
239 | 239 |
240 DISALLOW_COPY_AND_ASSIGN(SmsDetailedView); | 240 DISALLOW_COPY_AND_ASSIGN(SmsDetailedView); |
241 }; | 241 }; |
242 | 242 |
243 class TraySms::SmsNotificationView : public TrayNotificationView { | 243 class TraySms::SmsNotificationView : public TrayNotificationView { |
244 public: | 244 public: |
245 SmsNotificationView(TraySms* owner, | 245 SmsNotificationView(TraySms* owner, |
(...skipping 10 matching lines...) Expand all Loading... |
256 void Update(size_t message_index, | 256 void Update(size_t message_index, |
257 const std::string& number, | 257 const std::string& number, |
258 const std::string& text) { | 258 const std::string& text) { |
259 SmsMessageView* message_view = new SmsMessageView( | 259 SmsMessageView* message_view = new SmsMessageView( |
260 tray_sms(), SmsMessageView::VIEW_NOTIFICATION, | 260 tray_sms(), SmsMessageView::VIEW_NOTIFICATION, |
261 message_index_, number, text); | 261 message_index_, number, text); |
262 UpdateView(message_view); | 262 UpdateView(message_view); |
263 } | 263 } |
264 | 264 |
265 // Overridden from TrayNotificationView: | 265 // Overridden from TrayNotificationView: |
266 virtual void OnClose() OVERRIDE { | 266 virtual void OnClose() override { |
267 tray_sms()->RemoveMessage(message_index_); | 267 tray_sms()->RemoveMessage(message_index_); |
268 } | 268 } |
269 | 269 |
270 virtual void OnClickAction() OVERRIDE { | 270 virtual void OnClickAction() override { |
271 owner()->PopupDetailedView(0, true); | 271 owner()->PopupDetailedView(0, true); |
272 } | 272 } |
273 | 273 |
274 private: | 274 private: |
275 TraySms* tray_sms() { | 275 TraySms* tray_sms() { |
276 return static_cast<TraySms*>(owner()); | 276 return static_cast<TraySms*>(owner()); |
277 } | 277 } |
278 | 278 |
279 size_t message_index_; | 279 size_t message_index_; |
280 | 280 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 std::string number, text; | 410 std::string number, text; |
411 if (GetLatestMessage(&index, &number, &text)) | 411 if (GetLatestMessage(&index, &number, &text)) |
412 notification_->Update(index, number, text); | 412 notification_->Update(index, number, text); |
413 } else if (notify) { | 413 } else if (notify) { |
414 ShowNotificationView(); | 414 ShowNotificationView(); |
415 } | 415 } |
416 } | 416 } |
417 } | 417 } |
418 | 418 |
419 } // namespace ash | 419 } // namespace ash |
OLD | NEW |