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 <cinttypes> | 7 #include <cinttypes> |
8 #include <utility> | 8 #include <utility> |
oshima
2016/04/08 07:09:40
include?
| |
9 | 9 |
10 #include "ash/new_window_delegate.h" | 10 #include "ash/new_window_delegate.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/system/system_notifier.h" | 12 #include "ash/system/system_notifier.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "grit/ash_resources.h" | 14 #include "grit/ash_resources.h" |
15 #include "grit/ash_strings.h" | 15 #include "grit/ash_strings.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
17 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
18 #include "ui/message_center/message_center.h" | 18 #include "ui/message_center/message_center.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
70 // Always remove the notification to make sure the notification appears | 70 // Always remove the notification to make sure the notification appears |
71 // as a popup in any situation. | 71 // as a popup in any situation. |
72 message_center::MessageCenter::Get()->RemoveNotification( | 72 message_center::MessageCenter::Get()->RemoveNotification( |
73 kDisplayErrorNotificationId, false /* by_user */); | 73 kDisplayErrorNotificationId, false /* by_user */); |
74 | 74 |
75 int message_id = (new_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) ? | 75 int message_id = (new_state == ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR) ? |
76 IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING : | 76 IDS_ASH_DISPLAY_FAILURE_ON_MIRRORING : |
77 IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING; | 77 IDS_ASH_DISPLAY_FAILURE_ON_NON_MIRRORING; |
78 | 78 |
79 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 79 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
80 scoped_ptr<Notification> notification(new Notification( | 80 std::unique_ptr<Notification> notification(new Notification( |
81 message_center::NOTIFICATION_TYPE_SIMPLE, kDisplayErrorNotificationId, | 81 message_center::NOTIFICATION_TYPE_SIMPLE, kDisplayErrorNotificationId, |
82 base::string16(), // title | 82 base::string16(), // title |
83 l10n_util::GetStringUTF16(message_id), | 83 l10n_util::GetStringUTF16(message_id), |
84 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), | 84 bundle.GetImageNamed(IDR_AURA_NOTIFICATION_DISPLAY), |
85 base::string16(), // display_source | 85 base::string16(), // display_source |
86 GURL(), | 86 GURL(), |
87 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 87 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
88 system_notifier::kNotifierDisplayError), | 88 system_notifier::kNotifierDisplayError), |
89 message_center::RichNotificationData(), | 89 message_center::RichNotificationData(), |
90 new DisplayErrorNotificationDelegate)); | 90 new DisplayErrorNotificationDelegate)); |
91 message_center::MessageCenter::Get()->AddNotification( | 91 message_center::MessageCenter::Get()->AddNotification( |
92 std::move(notification)); | 92 std::move(notification)); |
93 } | 93 } |
94 | 94 |
95 base::string16 | 95 base::string16 |
96 DisplayErrorObserver::GetDisplayErrorNotificationMessageForTest() { | 96 DisplayErrorObserver::GetDisplayErrorNotificationMessageForTest() { |
97 message_center::NotificationList::Notifications notifications = | 97 message_center::NotificationList::Notifications notifications = |
98 message_center::MessageCenter::Get()->GetVisibleNotifications(); | 98 message_center::MessageCenter::Get()->GetVisibleNotifications(); |
99 for (message_center::NotificationList::Notifications::const_iterator iter = | 99 for (message_center::NotificationList::Notifications::const_iterator iter = |
100 notifications.begin(); iter != notifications.end(); ++iter) { | 100 notifications.begin(); iter != notifications.end(); ++iter) { |
101 if ((*iter)->id() == kDisplayErrorNotificationId) | 101 if ((*iter)->id() == kDisplayErrorNotificationId) |
102 return (*iter)->message(); | 102 return (*iter)->message(); |
103 } | 103 } |
104 | 104 |
105 return base::string16(); | 105 return base::string16(); |
106 } | 106 } |
107 | 107 |
108 } // namespace ash | 108 } // namespace ash |
OLD | NEW |