Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 var _streamsCache = []; | |
| 6 | |
| 7 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.
| |
| 8 if (_streamsCache.length > 0) { | |
| 9 var streamDetails = _streamsCache.pop(); | |
| 10 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.
| |
| 11 } | |
| 12 } | |
| 13 | |
| 5 chrome.streamsPrivate.onExecuteMimeTypeHandler.addListener( | 14 chrome.streamsPrivate.onExecuteMimeTypeHandler.addListener( |
| 6 function(mime_type, original_url, content_url, tab_id) { | 15 function(mime_type, original_url, content_url, tab_id) { |
| 7 // TODO(raymes): Currently this doesn't work with embedded PDFs (it | 16 // TODO(raymes): Currently this doesn't work with embedded PDFs (it |
| 8 // causes the entire frame to navigate). Also work out how we can | 17 // causes the entire frame to navigate). Also work out how we can |
| 9 // mask the URL with the URL of the PDF. | 18 // mask the URL with the URL of the PDF. |
| 10 chrome.tabs.update(tab_id, { url: 'index.html?' + content_url }); | 19 var streamDetails = { |
| 20 mimeType: mime_type, | |
| 21 originalURL: original_url, | |
| 22 streamURL: content_url | |
| 23 }; | |
| 24 _streamsCache.push(streamDetails); | |
| 25 chrome.tabs.update(tab_id, { url: 'index.html' }); | |
| 11 } | 26 } |
| 12 ); | 27 ); |
| OLD | NEW |