| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 script.removeEventListener('error', onError); | 53 script.removeEventListener('error', onError); |
| 54 document.body.removeChild(script); | 54 document.body.removeChild(script); |
| 55 | 55 |
| 56 if (opt_secondTry) { | 56 if (opt_secondTry) { |
| 57 // Shows error message and exits if it's the 2nd try. | 57 // Shows error message and exits if it's the 2nd try. |
| 58 console.error('Google Cast API extension load failed.'); | 58 console.error('Google Cast API extension load failed.'); |
| 59 return; | 59 return; |
| 60 } | 60 } |
| 61 | 61 |
| 62 // Installs the Google Cast API extension and retry loading. | 62 // Installs the Google Cast API extension and retry loading. |
| 63 chrome.fileBrowserPrivate.installWebstoreItem( | 63 chrome.fileManagerPrivate.installWebstoreItem( |
| 64 'mafeflapfdfljijmlienjedomfjfmhpd', | 64 'mafeflapfdfljijmlienjedomfjfmhpd', |
| 65 true, // Don't use installation prompt. | 65 true, // Don't use installation prompt. |
| 66 function() { | 66 function() { |
| 67 if (chrome.runtime.lastError) { | 67 if (chrome.runtime.lastError) { |
| 68 console.error('Google Cast API extension installation error.', | 68 console.error('Google Cast API extension installation error.', |
| 69 chrome.runtime.lastError.message); | 69 chrome.runtime.lastError.message); |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 | 72 |
| 73 console.info('Google Cast API extension installed.'); | 73 console.info('Google Cast API extension installed.'); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 } | 145 } |
| 146 | 146 |
| 147 player.setCastList(receivers); | 147 player.setCastList(receivers); |
| 148 } else if (availability == chrome.cast.ReceiverAvailability.UNAVAILABLE) { | 148 } else if (availability == chrome.cast.ReceiverAvailability.UNAVAILABLE) { |
| 149 player.setCastList([]); | 149 player.setCastList([]); |
| 150 } else { | 150 } else { |
| 151 console.error('Unexpected response in onReceiver.', arguments); | 151 console.error('Unexpected response in onReceiver.', arguments); |
| 152 player.setCastList([]); | 152 player.setCastList([]); |
| 153 } | 153 } |
| 154 } | 154 } |
| OLD | NEW |