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

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

Issue 3013012: Revert 52859. (Closed)
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/logging.h"
9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/notifications/desktop_notification_service.h"
11 #include "chrome/browser/profile.h"
12 #include "grit/generated_resources.h"
13
14 static const int kRevokePermissionCommand = 0;
15
16 NotificationOptionsMenuModel::NotificationOptionsMenuModel(Balloon* balloon)
17 : menus::SimpleMenuModel(this),
18 balloon_(balloon) {
19 const string16 label_text = WideToUTF16Hack(l10n_util::GetStringF(
20 IDS_NOTIFICATION_BALLOON_REVOKE_MESSAGE,
21 balloon->notification().display_source()));
22 AddItem(kRevokePermissionCommand, label_text);
23 }
24
25 NotificationOptionsMenuModel::~NotificationOptionsMenuModel() {
26 }
27
28 bool NotificationOptionsMenuModel::IsCommandIdChecked(int /* command_id */)
29 const {
30 // Nothing in the menu is checked.
31 return false;
32 }
33
34 bool NotificationOptionsMenuModel::IsCommandIdEnabled(int /* command_id */)
35 const {
36 // All the menu options are always enabled.
37 return true;
38 }
39
40 bool NotificationOptionsMenuModel::GetAcceleratorForCommandId(
41 int /* command_id */, menus::Accelerator* /* accelerator */) {
42 // Current no accelerators.
43 return false;
44 }
45
46 void NotificationOptionsMenuModel::ExecuteCommand(int command_id) {
47 DesktopNotificationService* service =
48 balloon_->profile()->GetDesktopNotificationService();
49 switch (command_id) {
50 case kRevokePermissionCommand:
51 service->DenyPermission(balloon_->notification().origin_url());
52 break;
53 default:
54 NOTREACHED();
55 break;
56 }
57 }
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