OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/display/display_error_observer_chromeos.h" | 5 #include "ash/display/display_error_observer_chromeos.h" |
6 | 6 |
7 #include "ash/system/system_notifier.h" | 7 #include "ash/system/system_notifier.h" |
8 #include "grit/ash_resources.h" | 8 #include "grit/ash_resources.h" |
9 #include "grit/ash_strings.h" | 9 #include "grit/ash_strings.h" |
10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 // as a popup in any situation. | 36 // as a popup in any situation. |
37 message_center::MessageCenter::Get()->RemoveNotification( | 37 message_center::MessageCenter::Get()->RemoveNotification( |
38 kDisplayErrorNotificationId, false /* by_user */); | 38 kDisplayErrorNotificationId, false /* by_user */); |
39 | 39 |
40 int message_id = (new_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) ? | 40 int message_id = (new_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) ? |
41 IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING : | 41 IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING : |
42 IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING; | 42 IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING; |
43 | 43 |
44 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 44 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
45 scoped_ptr<Notification> notification(new Notification( | 45 scoped_ptr<Notification> notification(new Notification( |
46 message_center::NOTIFICATION_TYPE_SIMPLE, | 46 message_center::NOTIFICATION_TYPE_SIMPLE, kDisplayErrorNotificationId, |
Jun Mukai
2015/06/17 21:54:43
Please keep the original linebreak
Jun Mukai
2015/06/17 22:32:53
You miss this comment. Put a line break between NO
rfrappier
2015/06/18 15:39:53
Done.
| |
47 kDisplayErrorNotificationId, | 47 base::string16(), // message |
Jun Mukai
2015/06/17 21:54:43
Please update the comment. Now this is title, not
rfrappier
2015/06/18 15:39:53
Done.
| |
48 l10n_util::GetStringUTF16(message_id), | 48 l10n_util::GetStringUTF16(message_id), |
49 base::string16(), // message | |
50 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), | 49 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), |
51 base::string16(), // display_source | 50 base::string16(), // display_source |
52 message_center::NotifierId( | 51 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
53 message_center::NotifierId::SYSTEM_COMPONENT, | 52 system_notifier::kNotifierDisplayError), |
54 system_notifier::kNotifierDisplayError), | 53 message_center::RichNotificationData(), NULL)); |
55 message_center::RichNotificationData(), | |
56 NULL)); | |
57 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); | 54 message_center::MessageCenter::Get()->AddNotification(notification.Pass()); |
58 } | 55 } |
59 | 56 |
60 base::string16 DisplayErrorObserver:: | 57 base::string16 DisplayErrorObserver:: |
61 GetTitleOfDisplayErrorNotificationForTest() { | 58 GetTitleOfDisplayErrorNotificationForTest() { |
62 message_center::NotificationList::Notifications notifications = | 59 message_center::NotificationList::Notifications notifications = |
63 message_center::MessageCenter::Get()->GetVisibleNotifications(); | 60 message_center::MessageCenter::Get()->GetVisibleNotifications(); |
64 for (message_center::NotificationList::Notifications::const_iterator iter = | 61 for (message_center::NotificationList::Notifications::const_iterator iter = |
65 notifications.begin(); iter != notifications.end(); ++iter) { | 62 notifications.begin(); iter != notifications.end(); ++iter) { |
66 if ((*iter)->id() == kDisplayErrorNotificationId) | 63 if ((*iter)->id() == kDisplayErrorNotificationId) |
67 return (*iter)->title(); | 64 return (*iter)->title(); |
68 } | 65 } |
69 | 66 |
70 return base::string16(); | 67 return base::string16(); |
71 } | 68 } |
72 | 69 |
73 } // namespace ash | 70 } // namespace ash |
OLD | NEW |