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 chrome.streamsPrivate.onExecuteMimeTypeHandler.addListener( | 5 (function() { |
6 function(mime_type, original_url, content_url, tab_id) { | 6 'use strict'; |
7 // TODO(raymes): Currently this doesn't work with embedded PDFs (it | 7 |
8 // causes the entire frame to navigate). Also work out how we can | 8 /** |
9 // mask the URL with the URL of the PDF. | 9 * Keep a stack of stream details for requests. These are pushed onto the |
10 chrome.tabs.update(tab_id, { url: 'index.html?' + content_url }); | 10 * stack as requests come in and popped off the stack as they are handled by a |
11 * renderer. | |
12 * TODO(raymes): This is probably racy for multiple requests. We could | |
13 * associate an ID with the request but this code will probably change | |
14 * completely when MIME type handling is improved. | |
15 */ | |
16 var streamsCache = []; | |
17 | |
18 window.popStreamDetails = function() { | |
19 if (streamsCache.length > 0) | |
20 return streamsCache.pop(); | |
11 } | 21 } |
arv (Not doing code reviews)
2014/02/21 14:41:03
missing semicolon now that is a statement.
raymes
2014/02/23 23:55:10
Done.
| |
12 ); | 22 |
23 chrome.streamsPrivate.onExecuteMimeTypeHandler.addListener( | |
24 function(mime_type, original_url, content_url, tab_id) { | |
arv (Not doing code reviews)
2014/02/21 14:41:03
no underscores in js
raymes
2014/02/23 23:55:10
Done.
| |
25 // TODO(raymes): Currently this doesn't work with embedded PDFs (it | |
26 // causes the entire frame to navigate). Also work out how we can | |
27 // mask the URL with the URL of the PDF. | |
28 var streamDetails = { | |
29 mimeType: mime_type, | |
30 originalURL: original_url, | |
31 streamURL: content_url | |
32 }; | |
33 streamsCache.push(streamDetails); | |
34 chrome.tabs.update(tab_id, { url: 'index.html' }); | |
arv (Not doing code reviews)
2014/02/21 14:41:03
no ws after { nor before }
raymes
2014/02/23 23:55:10
Done.
| |
35 } | |
36 ); | |
37 | |
38 }()); | |
OLD | NEW |