Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: chrome/browser/notifications/notification_options_menu_model.cc

Issue 3045003: Reapply r52859 (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "chrome/browser/notifications/notification_options_menu_model.h"
6
7 #include "app/l10n_util.h"
8 #include "base/compiler_specific.h"
9 #include "base/logging.h"
10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/notifications/desktop_notification_service.h"
12 #include "chrome/browser/profile.h"
13 #include "grit/generated_resources.h"
14
15 static const int kRevokePermissionCommand = 0;
16
17 NotificationOptionsMenuModel::NotificationOptionsMenuModel(Balloon* balloon)
18 : ALLOW_THIS_IN_INITIALIZER_LIST(menus::SimpleMenuModel(this)),
19 balloon_(balloon) {
20 const string16 label_text = WideToUTF16Hack(l10n_util::GetStringF(
21 IDS_NOTIFICATION_BALLOON_REVOKE_MESSAGE,
22 balloon->notification().display_source()));
23 AddItem(kRevokePermissionCommand, label_text);
24 }
25
26 NotificationOptionsMenuModel::~NotificationOptionsMenuModel() {
27 }
28
29 bool NotificationOptionsMenuModel::IsCommandIdChecked(int /* command_id */)
30 const {
31 // Nothing in the menu is checked.
32 return false;
33 }
34
35 bool NotificationOptionsMenuModel::IsCommandIdEnabled(int /* command_id */)
36 const {
37 // All the menu options are always enabled.
38 return true;
39 }
40
41 bool NotificationOptionsMenuModel::GetAcceleratorForCommandId(
42 int /* command_id */, menus::Accelerator* /* accelerator */) {
43 // Current no accelerators.
44 return false;
45 }
46
47 void NotificationOptionsMenuModel::ExecuteCommand(int command_id) {
48 DesktopNotificationService* service =
49 balloon_->profile()->GetDesktopNotificationService();
50 switch (command_id) {
51 case kRevokePermissionCommand:
52 service->DenyPermission(balloon_->notification().origin_url());
53 break;
54 default:
55 NOTREACHED();
56 break;
57 }
58 }
OLDNEW
« no previous file with comments | « chrome/browser/notifications/notification_options_menu_model.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698