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 /** | |
6 * Keep a stack of stream details for requests. These are pushed onto the stack | |
7 * as requests come in and popped off the stack as they are handled by a | |
8 * renderer. Using a stack here simply ensures they are handled in the same | |
9 * order that the requests come in. | |
koz (OOO until 15th September)
2014/02/19 01:52:10
Won't this mean that the requests get handled in r
| |
10 */ | |
11 var _streamsCache = []; | |
12 | |
13 function popStreamDetails() { | |
14 if (_streamsCache.length > 0) | |
15 return _streamsCache.pop(); | |
16 } | |
17 | |
5 chrome.streamsPrivate.onExecuteMimeTypeHandler.addListener( | 18 chrome.streamsPrivate.onExecuteMimeTypeHandler.addListener( |
6 function(mime_type, original_url, content_url, tab_id) { | 19 function(mime_type, original_url, content_url, tab_id) { |
7 // TODO(raymes): Currently this doesn't work with embedded PDFs (it | 20 // TODO(raymes): Currently this doesn't work with embedded PDFs (it |
8 // causes the entire frame to navigate). Also work out how we can | 21 // causes the entire frame to navigate). Also work out how we can |
9 // mask the URL with the URL of the PDF. | 22 // mask the URL with the URL of the PDF. |
10 chrome.tabs.update(tab_id, { url: 'index.html?' + content_url }); | 23 var streamDetails = { |
24 mimeType: mime_type, | |
25 originalURL: original_url, | |
26 streamURL: content_url | |
27 }; | |
28 _streamsCache.push(streamDetails); | |
29 chrome.tabs.update(tab_id, { url: 'index.html' }); | |
11 } | 30 } |
12 ); | 31 ); |
OLD | NEW |