| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "app/l10n_util.h" | |
| 6 #include "base/utf_string_conversions.h" | |
| 7 #include "chrome/browser/gtk/notifications/notification_options_menu_model.h" | |
| 8 #include "chrome/browser/notifications/balloon.h" | |
| 9 #include "chrome/browser/notifications/desktop_notification_service.h" | |
| 10 #include "chrome/browser/profile.h" | |
| 11 #include "grit/generated_resources.h" | |
| 12 #include "grit/theme_resources.h" | |
| 13 | |
| 14 using menus::MenuModel; | |
| 15 | |
| 16 NotificationOptionsMenuModel::NotificationOptionsMenuModel(Balloon* balloon) | |
| 17 : balloon_(balloon) { | |
| 18 } | |
| 19 | |
| 20 NotificationOptionsMenuModel::~NotificationOptionsMenuModel() { | |
| 21 } | |
| 22 | |
| 23 bool NotificationOptionsMenuModel::HasIcons() const { | |
| 24 return false; | |
| 25 } | |
| 26 | |
| 27 int NotificationOptionsMenuModel::GetItemCount() const { | |
| 28 return 1; | |
| 29 } | |
| 30 | |
| 31 MenuModel::ItemType NotificationOptionsMenuModel::GetTypeAt(int index) const { | |
| 32 return MenuModel::TYPE_COMMAND; | |
| 33 } | |
| 34 | |
| 35 int NotificationOptionsMenuModel::GetCommandIdAt(int index) const { | |
| 36 return index; | |
| 37 } | |
| 38 | |
| 39 string16 NotificationOptionsMenuModel::GetLabelAt(int index) const { | |
| 40 DCHECK_EQ(0, index); | |
| 41 | |
| 42 return l10n_util::GetStringFUTF16(IDS_NOTIFICATION_BALLOON_REVOKE_MESSAGE, | |
| 43 WideToUTF16(balloon_->notification().display_source())); | |
| 44 } | |
| 45 | |
| 46 bool NotificationOptionsMenuModel::IsLabelDynamicAt(int index) const { | |
| 47 return false; | |
| 48 } | |
| 49 | |
| 50 bool NotificationOptionsMenuModel::GetAcceleratorAt( | |
| 51 int index, menus::Accelerator* accelerator) const { | |
| 52 return false; | |
| 53 } | |
| 54 | |
| 55 bool NotificationOptionsMenuModel::IsItemCheckedAt(int index) const { | |
| 56 return false; | |
| 57 } | |
| 58 | |
| 59 int NotificationOptionsMenuModel::GetGroupIdAt(int index) const { | |
| 60 return 0; | |
| 61 } | |
| 62 | |
| 63 bool NotificationOptionsMenuModel::GetIconAt(int index, SkBitmap* icon) const { | |
| 64 return false; | |
| 65 } | |
| 66 | |
| 67 menus::ButtonMenuItemModel* NotificationOptionsMenuModel::GetButtonMenuItemAt( | |
| 68 int index) const { | |
| 69 return NULL; | |
| 70 } | |
| 71 | |
| 72 bool NotificationOptionsMenuModel::IsEnabledAt(int index) const { | |
| 73 return true; | |
| 74 } | |
| 75 | |
| 76 MenuModel* NotificationOptionsMenuModel::GetSubmenuModelAt(int index) const { | |
| 77 return NULL; | |
| 78 } | |
| 79 | |
| 80 void NotificationOptionsMenuModel::HighlightChangedTo(int index) { | |
| 81 } | |
| 82 | |
| 83 void NotificationOptionsMenuModel::ActivatedAt(int index) { | |
| 84 DCHECK_EQ(0, index); | |
| 85 | |
| 86 DesktopNotificationService* service = | |
| 87 balloon_->profile()->GetDesktopNotificationService(); | |
| 88 | |
| 89 service->DenyPermission(balloon_->notification().origin_url()); | |
| 90 } | |
| OLD | NEW |