OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 'use strict'; | 5 'use strict'; |
6 | 6 |
7 // This hack prevents a bug on the cast extension. | 7 // This hack prevents a bug on the cast extension. |
8 // TODO(yoshiki): Remove this once the cast extension supports Chrome apps. | 8 // TODO(yoshiki): Remove this once the cast extension supports Chrome apps. |
9 // Although localStorage in Chrome app is not supported, but it's used in the | 9 // Although localStorage in Chrome app is not supported, but it's used in the |
10 // cast extension. This line prevents an exception on using localStorage. | 10 // cast extension. This line prevents an exception on using localStorage. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 console.error('Either "Google Cast API" or "Google Cast" extension ' + | 65 console.error('Either "Google Cast API" or "Google Cast" extension ' + |
66 'seems not to be installed?'); | 66 'seems not to be installed?'); |
67 }.wrap(), 5000); | 67 }.wrap(), 5000); |
68 | 68 |
69 window['__onGCastApiAvailable'] = function(loaded, errorInfo) { | 69 window['__onGCastApiAvailable'] = function(loaded, errorInfo) { |
70 clearTimeout(checkTimer); | 70 clearTimeout(checkTimer); |
71 | 71 |
72 if (loaded) | 72 if (loaded) |
73 callback(); | 73 callback(); |
74 else | 74 else |
75 console.error('Google Cast exntnsion load failed.', errorInfo); | 75 console.error('Google Cast extension load failed.', errorInfo); |
76 }.wrap(); | 76 }.wrap(); |
77 } else { | 77 } else { |
78 setTimeout(callback); // Runs asynchronously. | 78 setTimeout(callback); // Runs asynchronously. |
79 } | 79 } |
80 }.wrap(); | 80 }.wrap(); |
81 | 81 |
82 script.src = '_modules/mafeflapfdfljijmlienjedomfjfmhpd/cast_sender.js'; | 82 script.src = '_modules/mafeflapfdfljijmlienjedomfjfmhpd/cast_sender.js'; |
83 script.addEventListener('error', onError); | 83 script.addEventListener('error', onError); |
84 script.addEventListener('load', onLoad); | 84 script.addEventListener('load', onLoad); |
85 document.body.appendChild(script); | 85 document.body.appendChild(script); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 player.setCastList(receivers); | 125 player.setCastList(receivers); |
126 } else if (availability == chrome.cast.ReceiverAvailability.UNAVAILABLE) { | 126 } else if (availability == chrome.cast.ReceiverAvailability.UNAVAILABLE) { |
127 player.setCastList([]); | 127 player.setCastList([]); |
128 } else { | 128 } else { |
129 console.error('Unexpected response in onReceiver.', arguments); | 129 console.error('Unexpected response in onReceiver.', arguments); |
130 player.setCastList([]); | 130 player.setCastList([]); |
131 } | 131 } |
132 } | 132 } |
OLD | NEW |