Chromium Code Reviews| 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/session_length_limit/tray_session_length_limit.h" | 5 #include "ash/system/session_length_limit/tray_session_length_limit.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ash/shelf/shelf_types.h" | 9 #include "ash/shelf/shelf_types.h" |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 | 71 |
| 72 base::string16 FormatRemainingSessionTimeNotification( | 72 base::string16 FormatRemainingSessionTimeNotification( |
| 73 const base::TimeDelta& remaining_session_time) { | 73 const base::TimeDelta& remaining_session_time) { |
| 74 return l10n_util::GetStringFUTF16( | 74 return l10n_util::GetStringFUTF16( |
| 75 IDS_ASH_STATUS_TRAY_REMAINING_SESSION_TIME_NOTIFICATION, | 75 IDS_ASH_STATUS_TRAY_REMAINING_SESSION_TIME_NOTIFICATION, |
| 76 ui::TimeFormat::TimeDurationLong(remaining_session_time)); | 76 ui::TimeFormat::TimeDurationLong(remaining_session_time)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void CreateOrUpdateNotification(const base::TimeDelta& remaining_time, | 79 void CreateOrUpdateNotification(const base::TimeDelta& remaining_time, |
| 80 bool enable_spoken_feedback) { | 80 bool enable_spoken_feedback) { |
| 81 message_center::MessageCenter* message_center = | |
| 82 message_center::MessageCenter::Get(); | |
| 83 // If |enable_spoken_feedback| is false, it's just an update of the content, | |
| 84 // which should not create a new one if it's already closed. | |
|
stevenjb
2013/09/09 17:58:03
nit: s/one/notification
Jun Mukai
2013/09/09 19:37:25
Done.
| |
| 85 if (!enable_spoken_feedback && | |
| 86 !message_center->HasNotification(kSessionLengthTimeoutNotificationId)) { | |
|
stevenjb
2013/09/09 17:58:03
This seems awkward; we're effectively using 'enabl
Jun Mukai
2013/09/09 19:37:25
I don't think I need to separate the function / lo
stevenjb
2013/09/09 19:43:07
OK, that's more clear now.
| |
| 87 return; | |
| 88 } | |
| 89 | |
| 81 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 90 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 82 message_center::RichNotificationData data; | 91 message_center::RichNotificationData data; |
| 83 data.should_make_spoken_feedback_for_popup_updates = enable_spoken_feedback; | 92 data.should_make_spoken_feedback_for_popup_updates = enable_spoken_feedback; |
| 84 scoped_ptr<Notification> notification(new Notification( | 93 scoped_ptr<Notification> notification(new Notification( |
| 85 message_center::NOTIFICATION_TYPE_SIMPLE, | 94 message_center::NOTIFICATION_TYPE_SIMPLE, |
| 86 kSessionLengthTimeoutNotificationId, | 95 kSessionLengthTimeoutNotificationId, |
| 87 FormatRemainingSessionTimeNotification(remaining_time), | 96 FormatRemainingSessionTimeNotification(remaining_time), |
| 88 base::string16() /* message */, | 97 base::string16() /* message */, |
| 89 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SESSION_LENGTH_LIMIT_TIMER), | 98 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_SESSION_LENGTH_LIMIT_TIMER), |
| 90 base::string16() /* display_source */, | 99 base::string16() /* display_source */, |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 } | 363 } |
| 355 | 364 |
| 356 // Update the tray view last so that it can check whether the notification | 365 // Update the tray view last so that it can check whether the notification |
| 357 // view is currently visible or not. | 366 // view is currently visible or not. |
| 358 if (tray_view_) | 367 if (tray_view_) |
| 359 tray_view_->Update(); | 368 tray_view_->Update(); |
| 360 } | 369 } |
| 361 | 370 |
| 362 } // namespace internal | 371 } // namespace internal |
| 363 } // namespace ash | 372 } // namespace ash |
| OLD | NEW |