| 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/accessibility/accessible_view_state.h" | 9 #include "ui/base/accessibility/accessible_view_state.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 if (!extension_id.empty() && !display_source.empty()) { | 240 if (!extension_id.empty() && !display_source.empty()) { |
| 241 AddItem(kToggleExtensionCommand, | 241 AddItem(kToggleExtensionCommand, |
| 242 l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_EXTENSIONS_DISABLE, | 242 l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_EXTENSIONS_DISABLE, |
| 243 display_source)); | 243 display_source)); |
| 244 } else if (!display_source.empty()) { | 244 } else if (!display_source.empty()) { |
| 245 AddItem(kTogglePermissionCommand, | 245 AddItem(kTogglePermissionCommand, |
| 246 l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_SITE_DISABLE, | 246 l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_SITE_DISABLE, |
| 247 display_source)); | 247 display_source)); |
| 248 } | 248 } |
| 249 // Add settings menu item. | 249 // Add settings menu item. |
| 250 if (message_center::IsRichNotificationEnabled() || !display_source.empty()) { | 250 AddItem(kShowSettingsCommand, |
| 251 AddItem(kShowSettingsCommand, | 251 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_SETTINGS)); |
| 252 l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_SETTINGS)); | |
| 253 } | |
| 254 } | 252 } |
| 255 | 253 |
| 256 MenuModel::~MenuModel() { | 254 MenuModel::~MenuModel() { |
| 257 } | 255 } |
| 258 | 256 |
| 259 bool MenuModel::IsItemForCommandIdDynamic(int command_id) const { | 257 bool MenuModel::IsItemForCommandIdDynamic(int command_id) const { |
| 260 return false; | 258 return false; |
| 261 } | 259 } |
| 262 | 260 |
| 263 bool MenuModel::IsCommandIdChecked(int command_id) const { | 261 bool MenuModel::IsCommandIdChecked(int command_id) const { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 276 void MenuModel::ExecuteCommand(int command_id, int event_flags) { | 274 void MenuModel::ExecuteCommand(int command_id, int event_flags) { |
| 277 switch (command_id) { | 275 switch (command_id) { |
| 278 case kToggleExtensionCommand: | 276 case kToggleExtensionCommand: |
| 279 message_center_->DisableNotificationsByExtension(notification_id_); | 277 message_center_->DisableNotificationsByExtension(notification_id_); |
| 280 break; | 278 break; |
| 281 case kTogglePermissionCommand: | 279 case kTogglePermissionCommand: |
| 282 message_center_->DisableNotificationsByUrl(notification_id_); | 280 message_center_->DisableNotificationsByUrl(notification_id_); |
| 283 break; | 281 break; |
| 284 case kShowSettingsCommand: | 282 case kShowSettingsCommand: |
| 285 // |tray_| may be NULL in tests. | 283 // |tray_| may be NULL in tests. |
| 286 if (message_center::IsRichNotificationEnabled() && tray_) | 284 if (tray_) |
| 287 tray_->ShowNotifierSettingsBubble(); | 285 tray_->ShowNotifierSettingsBubble(); |
| 288 else | 286 else |
| 289 message_center_->ShowNotificationSettings(notification_id_); | 287 message_center_->ShowNotificationSettings(notification_id_); |
| 290 break; | 288 break; |
| 291 default: | 289 default: |
| 292 NOTREACHED(); | 290 NOTREACHED(); |
| 293 } | 291 } |
| 294 } | 292 } |
| 295 | 293 |
| 296 } // namespace | 294 } // namespace |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 is_expanded_ = true; | 487 is_expanded_ = true; |
| 490 message_center_->ExpandNotification(notification_id_); | 488 message_center_->ExpandNotification(notification_id_); |
| 491 } | 489 } |
| 492 } | 490 } |
| 493 | 491 |
| 494 void MessageView::OnSlideOut() { | 492 void MessageView::OnSlideOut() { |
| 495 message_center_->RemoveNotification(notification_id_, true); // By user. | 493 message_center_->RemoveNotification(notification_id_, true); // By user. |
| 496 } | 494 } |
| 497 | 495 |
| 498 } // namespace message_center | 496 } // namespace message_center |
| OLD | NEW |