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

Unified Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 3141042: DevTools: support disabled and checked context menu items. (Closed)
Patch Set: With enabled. Created 10 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/render_view_context_menu.cc
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 2fae258cf1e288d39977fb38067ec6e3ac50bce1..f2d53838206855c1413c628259b654fb97d41dc5 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -412,6 +412,10 @@ bool RenderViewContextMenu::AppendCustomItems() {
IDC_CONTENT_CONTEXT_CUSTOM_LAST);
if (custom_items[i].type == WebMenuItem::SEPARATOR) {
menu_model_.AddSeparator();
+ } else if (custom_items[i].type == WebMenuItem::CHECKABLE_OPTION) {
+ menu_model_.AddCheckItem(
+ custom_items[i].action + IDC_CONTENT_CONTEXT_CUSTOM_FIRST,
+ custom_items[i].label);
} else {
menu_model_.AddItem(
custom_items[i].action + IDC_CONTENT_CONTEXT_CUSTOM_FIRST,
@@ -748,6 +752,18 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
return false;
}
+ // Custom WebKit items.
+ if (id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST &&
+ id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) {
+ const std::vector<WebMenuItem>& custom_items = params_.custom_items;
+ for (size_t i = 0; i < custom_items.size(); ++i) {
+ int action_id = IDC_CONTENT_CONTEXT_CUSTOM_FIRST + custom_items[i].action;
+ if (action_id == id)
+ return custom_items[i].enabled;
+ }
yurys 2010/08/25 12:55:29 There should be ASSERT_NOT_REACHED();
+ return true;
+ }
+
// Extension items.
if (id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST &&
id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) {
@@ -971,6 +987,19 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const {
WebContextMenuData::MediaControls) != 0;
}
+ // Custom WebKit items.
+ if (id >= IDC_CONTENT_CONTEXT_CUSTOM_FIRST &&
+ id <= IDC_CONTENT_CONTEXT_CUSTOM_LAST) {
+ const std::vector<WebMenuItem>& custom_items = params_.custom_items;
+ for (size_t i = 0; i < custom_items.size(); ++i) {
+ int action_id = IDC_CONTENT_CONTEXT_CUSTOM_FIRST + custom_items[i].action;
+ if (action_id == id)
+ return custom_items[i].checked;
+ }
+ return false;
yurys 2010/08/25 12:55:29 ditto.
+ }
+
+ // Extension items.
if (id >= IDC_EXTENSIONS_CONTEXT_CUSTOM_FIRST &&
id <= IDC_EXTENSIONS_CONTEXT_CUSTOM_LAST) {
ExtensionMenuItem* item = GetExtensionMenuItem(id);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698