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/common/system/locale/locale_notification_controller.h" | 5 #include "ash/common/system/locale/locale_notification_controller.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/system/system_notifier.h" | 9 #include "ash/common/system/system_notifier.h" |
10 #include "ash/common/system/tray/system_tray_notifier.h" | 10 #include "ash/common/system/tray/system_tray_notifier.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 void LocaleNotificationController::OnLocaleChanged( | 83 void LocaleNotificationController::OnLocaleChanged( |
84 LocaleObserver::Delegate* delegate, | 84 LocaleObserver::Delegate* delegate, |
85 const std::string& cur_locale, | 85 const std::string& cur_locale, |
86 const std::string& from_locale, | 86 const std::string& from_locale, |
87 const std::string& to_locale) { | 87 const std::string& to_locale) { |
88 if (!delegate) | 88 if (!delegate) |
89 return; | 89 return; |
90 | 90 |
91 base::string16 from = l10n_util::GetDisplayNameForLocale( | 91 base::string16 from = |
92 from_locale, cur_locale, true); | 92 l10n_util::GetDisplayNameForLocale(from_locale, cur_locale, true); |
93 base::string16 to = l10n_util::GetDisplayNameForLocale( | 93 base::string16 to = |
94 to_locale, cur_locale, true); | 94 l10n_util::GetDisplayNameForLocale(to_locale, cur_locale, true); |
95 | 95 |
96 message_center::RichNotificationData optional; | 96 message_center::RichNotificationData optional; |
97 optional.buttons.push_back(message_center::ButtonInfo( | 97 optional.buttons.push_back( |
98 l10n_util::GetStringFUTF16( | 98 message_center::ButtonInfo(l10n_util::GetStringFUTF16( |
99 IDS_ASH_STATUS_TRAY_LOCALE_REVERT_MESSAGE, from))); | 99 IDS_ASH_STATUS_TRAY_LOCALE_REVERT_MESSAGE, from))); |
100 optional.never_timeout = true; | 100 optional.never_timeout = true; |
101 | 101 |
102 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 102 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
103 std::unique_ptr<Notification> notification(new Notification( | 103 std::unique_ptr<Notification> notification(new Notification( |
104 message_center::NOTIFICATION_TYPE_SIMPLE, kLocaleChangeNotificationId, | 104 message_center::NOTIFICATION_TYPE_SIMPLE, kLocaleChangeNotificationId, |
105 base::string16() /* title */, | 105 base::string16() /* title */, |
106 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_LOCALE_CHANGE_MESSAGE, | 106 l10n_util::GetStringFUTF16(IDS_ASH_STATUS_TRAY_LOCALE_CHANGE_MESSAGE, |
107 from, to), | 107 from, to), |
108 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_LOCALE), | 108 bundle.GetImageNamed(IDR_AURA_UBER_TRAY_LOCALE), |
109 base::string16() /* display_source */, GURL(), | 109 base::string16() /* display_source */, GURL(), |
110 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, | 110 message_center::NotifierId(message_center::NotifierId::SYSTEM_COMPONENT, |
111 system_notifier::kNotifierLocale), | 111 system_notifier::kNotifierLocale), |
112 optional, new LocaleNotificationDelegate(delegate))); | 112 optional, new LocaleNotificationDelegate(delegate))); |
113 message_center::MessageCenter::Get()->AddNotification( | 113 message_center::MessageCenter::Get()->AddNotification( |
114 std::move(notification)); | 114 std::move(notification)); |
115 } | 115 } |
116 | 116 |
117 } // namespace ash | 117 } // namespace ash |
OLD | NEW |