Create context menu / menu item in devtools panel?

795 views
Skip to first unread message

simp...@gmail.com

unread,
May 13, 2013, 8:15:00 AM5/13/13
to google-chrome-...@googlegroups.com
I'm working on a devtools panel extension, and would like to create a context menu item.  So far I'm not able to get it to work.
I notice that there is no context menu at all on my panel -- no effect when right-clicking.  I do see context menus on some of the other devtools panels though.

My code to create the menu item (after adding the contextMenus permission to the manifest) is like so:

    chrome.contextMenus.create( {
        type: "normal",
        id: "obCm",
        title: "obCm",
        contexts: [ "all" ] }, function() {
            alert( "context create callback" );
            if( !! chrome.runtime.lastError ) {
                alert( "Error creating callback: ", chrome.runtime.lastError );
            }
    } );

When I call this in my event page, I see my new item appear on the context menu for normal pages, but not on my panel.

When I tried to call it in my devtools script and my custom panel script, in both cases chrome.contextMenus was undefined.

I don't see any other questions about this, and nothing in the docs jumps out at me (other than "Context menu items can appear in any document").  Hopefully I'm just doing something wrong.

Any thought on whether or not this is possible, and what to do differently if so?

Thanks much!
Ross

PhistucK

unread,
May 13, 2013, 8:47:16 AM5/13/13
to simp...@gmail.com, Google Chrome Developer Tools
1. You cannot use Chrome extension APIs (other than chrome.devtools.x or message passing mechanisms) within Developer Tools panels.
2. I do not believe you can manipulate the Developer Tools context menus using extensions at all, only normal web pages and this is by design (at the moment, anyway).


PhistucK



--
You received this message because you are subscribed to the Google Groups "Google Chrome Developer Tools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-chrome-develo...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages