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