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 "ui/message_center/views/message_view.h" | 5 #include "ui/message_center/views/message_view.h" |
6 | 6 |
7 #include "grit/ui_resources.h" | 7 #include "grit/ui_resources.h" |
8 #include "grit/ui_strings.h" | 8 #include "grit/ui_strings.h" |
9 #include "ui/base/l10n/l10n_util.h" | 9 #include "ui/base/l10n/l10n_util.h" |
10 #include "ui/base/models/simple_menu_model.h" | 10 #include "ui/base/models/simple_menu_model.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 }; | 208 }; |
209 | 209 |
210 MenuModel::MenuModel(message_center::NotificationChangeObserver* observer, | 210 MenuModel::MenuModel(message_center::NotificationChangeObserver* observer, |
211 const std::string& notification_id, | 211 const std::string& notification_id, |
212 const string16& display_source, | 212 const string16& display_source, |
213 const std::string& extension_id) | 213 const std::string& extension_id) |
214 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), | 214 : ALLOW_THIS_IN_INITIALIZER_LIST(ui::SimpleMenuModel(this)), |
215 observer_(observer), | 215 observer_(observer), |
216 notification_id_(notification_id) { | 216 notification_id_(notification_id) { |
217 // Add 'disable notifications' menu item. | 217 // Add 'disable notifications' menu item. |
218 if (!extension_id.empty()) { | 218 if (!extension_id.empty() && !display_source.empty()) { |
219 AddItem(kToggleExtensionCommand, | 219 AddItem(kToggleExtensionCommand, |
220 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_EXTENSIONS_DISABLE)); | 220 l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_EXTENSIONS_DISABLE, |
| 221 display_source)); |
221 } else if (!display_source.empty()) { | 222 } else if (!display_source.empty()) { |
222 AddItem(kTogglePermissionCommand, | 223 AddItem(kTogglePermissionCommand, |
223 l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_SITE_DISABLE, | 224 l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_SITE_DISABLE, |
224 display_source)); | 225 display_source)); |
225 } | 226 } |
226 // Add settings menu item. | 227 // Add settings menu item. |
227 if (message_center::IsRichNotificationEnabled() || !display_source.empty()) { | 228 if (message_center::IsRichNotificationEnabled() || !display_source.empty()) { |
228 AddItem(kShowSettingsCommand, | 229 AddItem(kShowSettingsCommand, |
229 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_SETTINGS)); | 230 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_SETTINGS)); |
230 } | 231 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 gfx::Rect(screen_location, gfx::Size()), | 377 gfx::Rect(screen_location, gfx::Size()), |
377 views::MenuItemView::TOPRIGHT, | 378 views::MenuItemView::TOPRIGHT, |
378 views::MenuRunner::HAS_MNEMONICS)); | 379 views::MenuRunner::HAS_MNEMONICS)); |
379 } | 380 } |
380 | 381 |
381 void MessageView::OnSlideOut() { | 382 void MessageView::OnSlideOut() { |
382 observer_->OnRemoveNotification(notification_id_, true); // By user. | 383 observer_->OnRemoveNotification(notification_id_, true); // By user. |
383 } | 384 } |
384 | 385 |
385 } // namespace message_center | 386 } // namespace message_center |
OLD | NEW |