disabling popup for browser action

598 views
Skip to first unread message

Ken Liu

unread,
Mar 15, 2010, 3:50:41 PM3/15/10
to chromium-...@chromium.org
Is it possible to programmatically disable the popup for a browser
action? I would like to be able to control whether a popup is
displayed.

Thanks,

Ken

Finnur Thorarinsson

unread,
Mar 15, 2010, 4:01:11 PM3/15/10
to Ken Liu, Chromium-extensions, ske...@chromium.org

This was checked in in February, but I'm not sure which build branches the fix has made it into...
http://code.google.com/p/chromium/issues/detail?id=27526



--
You received this message because you are subscribed to the Google Groups "Chromium-extensions" group.
To post to this group, send email to chromium-...@chromium.org.
To unsubscribe from this group, send email to chromium-extens...@chromium.org.
For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-extensions/?hl=en.


Sam Kerner

unread,
Mar 15, 2010, 5:38:15 PM3/15/10
to Finnur Thorarinsson, Ken Liu, Chromium-extensions
On Mon, Mar 15, 2010 at 1:01 PM, Finnur Thorarinsson
<fin...@chromium.org> wrote:
>
> This was checked in in February, but I'm not sure which build branches the
> fix has made it into...
> http://code.google.com/p/chromium/issues/detail?id=27526

r37353 adds chrome.browserAction.setPopup(). Setting the popup to the
empty string disables the popup. The stable channel on windows got
this change in the last update.

Sam

*: http://codereview.chromium.org/545068

Mohamed Mansour

unread,
Mar 15, 2010, 5:57:17 PM3/15/10
to Sam Kerner, Finnur Thorarinsson, Ken Liu, Chromium-extensions
Hi Sam,

I am testing this out, since I need the user to have an option to whether to enable/disable since some people do not like to have a browserAction for it.

I tried the following:

chrome.browserAction.setPopup("");
 Uncaught Error: Invalid value for argument 0. Expected 'object' but got 'string'.


Then I tried the following:

chrome.browserAction.setPopup({});
Uncaught Error: Invalid value for argument 0. Property 'popup': Property is required. 

When you mean disabled, does that mean it will be not visible in the toolbar?

-
Mohamed Mansour
m...@chromium.org

Sam Kerner

unread,
Mar 15, 2010, 6:17:53 PM3/15/10
to Finnur Thorarinsson, Ken Liu, Chromium-extensions
On Mon, Mar 15, 2010 at 2:38 PM, Sam Kerner <ske...@google.com> wrote:
> On Mon, Mar 15, 2010 at 1:01 PM, Finnur Thorarinsson
> <fin...@chromium.org> wrote:
>>
>> This was checked in in February, but I'm not sure which build branches the
>> fix has made it into...
>> http://code.google.com/p/chromium/issues/detail?id=27526
>
> r37353 adds chrome.browserAction.setPopup().  Setting the popup to the
> empty string disables the popup.  The stable channel on windows got
> this change in the last update.
>

I was wrong. chrome.browserAction.setPopup() is not yet available in
windows stable or beta. The dev channel has it.

Sam

Adam Hughes

unread,
Mar 15, 2010, 6:34:11 PM3/15/10
to Mohamed Mansour, Sam Kerner, Finnur Thorarinsson, Ken Liu, Chromium-extensions
Try:

chrome.browserAction.setPopup({popup:""});


Sam Kerner

unread,
Mar 15, 2010, 6:37:29 PM3/15/10
to Mohamed Mansour, Finnur Thorarinsson, Ken Liu, Chromium-extensions
On Mon, Mar 15, 2010 at 2:57 PM, Mohamed Mansour
<m0.inte...@gmail.com> wrote:
> Hi Sam,
> I am testing this out, since I need the user to have an option to whether to
> enable/disable since some people do not like to have a browserAction for it.
>
> I tried the following:
>>
>> chrome.browserAction.setPopup("");
>>
>>  Uncaught Error: Invalid value for argument 0. Expected 'object' but got
>> 'string'.
>
> Then I tried the following:
>
>> chrome.browserAction.setPopup({});
>>
>> Uncaught Error: Invalid value for argument 0. Property 'popup': Property
>> is required.

Mohamed,
Sorry to give a bad example. This time I will copy from a working test case:

// Disable the popup on the selected tab:
chrpme.tabs.getSelected(null, function(tab) {
chrome.browserAction.setPopup({
tabId: tab.id,
popup: '' // Empty string means no popup.
});
});

If you omit tabId, you set the default for tabs that have not been
explicitly set by a call with tabId.

>
> When you mean disabled, does that mean it will be not visible in the
> toolbar?

By "disabled", I mean it is as if you had not set a popup in the
manifest. So there will still be a browser action button in the
toolbar. chrome.browserAction.onClicked will fire when the user
clicks on the button.

Sam

Reply all
Reply to author
Forward
0 new messages