Chromium Code Reviews| Index: chrome/browser/resources/pdf/background.js |
| diff --git a/chrome/browser/resources/pdf/background.js b/chrome/browser/resources/pdf/background.js |
| index 06f5b2e0d768225039bf04a19d041ac281247e11..d1739ceb7f6a0841d0808d5fb1bc855f1651a607 100644 |
| --- a/chrome/browser/resources/pdf/background.js |
| +++ b/chrome/browser/resources/pdf/background.js |
| @@ -2,11 +2,26 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +var _streamsCache = []; |
| + |
| +function getStreamDetails() { |
|
koz (OOO until 15th September)
2014/02/18 05:15:07
nit: It's slightly odd that a get* function has si
raymes
2014/02/19 00:22:15
Done.
|
| + if (_streamsCache.length > 0) { |
| + var streamDetails = _streamsCache.pop(); |
| + return streamDetails; |
|
koz (OOO until 15th September)
2014/02/18 05:15:07
nit: just return _streamsCache.pop();
Also: why d
raymes
2014/02/19 00:22:15
Done.
|
| + } |
| +} |
| + |
| chrome.streamsPrivate.onExecuteMimeTypeHandler.addListener( |
| function(mime_type, original_url, content_url, tab_id) { |
| // TODO(raymes): Currently this doesn't work with embedded PDFs (it |
| // causes the entire frame to navigate). Also work out how we can |
| // mask the URL with the URL of the PDF. |
| - chrome.tabs.update(tab_id, { url: 'index.html?' + content_url }); |
| + var streamDetails = { |
| + mimeType: mime_type, |
| + originalURL: original_url, |
| + streamURL: content_url |
| + }; |
| + _streamsCache.push(streamDetails); |
| + chrome.tabs.update(tab_id, { url: 'index.html' }); |
| } |
| ); |