Capture chrome tab without browse action
<p>I have a simple method which captures current tab, and it works only when this method triggered by click on extension button (i.e. browserAction). </p>

<p>But when I use this method in setTimeout event it fails with following error:</p>

<pre><code>Unchecked runtime.lastError while running tabCapture.capture: Extension has not been invoked for the current page (see activeTab permission). Chrome pages cannot be captured.
</code></pre>

<p>My simple capture method is:</p>

<pre><code>function captureTab() {
    var constraints = ...
    chrome.tabCapture.capture(constraints, function (stream) {
        if (!stream) {
            console.error("couldn't record tab");
            return;
        }
        // recording succeeded
    });
} 
</code></pre>

<p>And it works when it triggered as follows:</p>

<pre><code>chrome.browserAction.onClicked.addListener(function () {
    chrome.tabs.getSelected(null, function (tab) {
        captureTab();
    });
});
</code></pre>

<p>But <strong>doesn't</strong> work when it triggered as follows:</p>

<pre><code>setTimeout(function () {
    chrome.tabs.getSelected(1, function (tab) {
        captureTab();            
    });
}, 1 * 30 * 1000);
</code></pre>

<p><strong>Important note:</strong> My extension isn't a public extension and it runs only on my browser so I can add any command line switch on start (in order to disable this limitation), if needed.</p>