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

Unified Diff: chrome/browser/gtk/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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/gtk/notifications/notification_options_menu_model.cc
diff --git a/chrome/browser/gtk/notifications/notification_options_menu_model.cc b/chrome/browser/gtk/notifications/notification_options_menu_model.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9b5225af8aa3f084429479d35df5a973fc65cd0d
--- /dev/null
+++ b/chrome/browser/gtk/notifications/notification_options_menu_model.cc
@@ -0,0 +1,90 @@
+// 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;
+}
+
+menus::ButtonMenuItemModel* NotificationOptionsMenuModel::GetButtonMenuItemAt(
+ int index) const {
+ return NULL;
+}
+
+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());
+}

Powered by Google App Engine
This is Rietveld 408576698