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

Unified Diff: chrome/browser/media_galleries/media_gallery_context_menu.cc

Issue 148093011: Abstract media galleries context menu code and use it in scan result dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Header too Created 6 years, 11 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/media_galleries/media_gallery_context_menu.cc
diff --git a/chrome/browser/media_galleries/media_gallery_context_menu.cc b/chrome/browser/media_galleries/media_gallery_context_menu.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4fc99f0ea7270ea4c8f5afe325371f10802465ff
--- /dev/null
+++ b/chrome/browser/media_galleries/media_gallery_context_menu.cc
@@ -0,0 +1,40 @@
+// Copyright 2014 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 "chrome/browser/media_galleries/media_gallery_context_menu.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/models/menu_model.h"
+
+MediaGalleryContextMenu::MediaGalleryContextMenu(
+ const ForgetGalleryCallback& callback)
+ : ui::SimpleMenuModel(NULL),
+ callback_(callback) {
+ set_delegate(this);
+ AddItem(1, l10n_util::GetStringUTF16(IDS_MEDIA_GALLERIES_DIALOG_DELETE));
+}
+
+MediaGalleryContextMenu::~MediaGalleryContextMenu() {}
+
+bool MediaGalleryContextMenu::IsCommandIdChecked(int command_id) const {
+ return false;
+}
+
+bool MediaGalleryContextMenu::IsCommandIdEnabled(int command_id) const {
+ return true;
+}
+
+bool MediaGalleryContextMenu::IsCommandIdVisible(int command_id) const {
+ return true;
+}
+
+bool MediaGalleryContextMenu::GetAcceleratorForCommandId(
+ int command_id, ui::Accelerator* accelerator) {
+ return false;
+}
+
+void MediaGalleryContextMenu::ExecuteCommand(int command_id,
+ int event_flags) {
Lei Zhang 2014/01/29 00:26:24 nit: indentation
vandebo (ex-Chrome) 2014/01/29 17:16:55 Done.
+ callback_.Run(pref_id_);
+}

Powered by Google App Engine
This is Rietveld 408576698