| 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 // TODO(crbug.com/689773): Update to use <script> |
| 6 |
| 5 /** | 7 /** |
| 6 * Discover the ID of installed cast extension. | 8 * Discover the ID of installed cast extension. |
| 7 * @constructor | 9 * @constructor |
| 8 * @struct | 10 * @struct |
| 9 */ | 11 */ |
| 10 function CastExtensionDiscoverer() {} | 12 function CastExtensionDiscoverer() {} |
| 11 | 13 |
| 12 /** | 14 /** |
| 13 * Tentatice IDs to try. | 15 * Tentative IDs to try. |
| 14 * @type {!Array<string>} | 16 * @type {!Array<string>} |
| 15 * @const | 17 * @const |
| 16 */ | 18 */ |
| 17 CastExtensionDiscoverer.CAST_EXTENSION_IDS = [ | 19 CastExtensionDiscoverer.CAST_EXTENSION_IDS = [ |
| 18 'pkedcjkdefgpdelpbcmbmeomcjbeemfm', // MR official | 20 'enhhojjnijigcajfphajepfemndkmdlo', // Media Router Dev |
| 19 'boadgeojelhgndaghljhdicfkmllpafd', // release | 21 'pkedcjkdefgpdelpbcmbmeomcjbeemfm' // Media Router Stable |
| 20 'dliochdbjfkdbacpmhlcpmleaejidimm', // beta | |
| 21 'enhhojjnijigcajfphajepfemndkmdlo', // dev | |
| 22 'fmfcbgogabcbclcofgocippekhfcmgfj', // staging | |
| 23 'fjhoaacokmgbjemoflkofnenfaiekifl' // stable used during MR development. | |
| 24 ]; | 22 ]; |
| 25 | 23 |
| 26 /** | 24 /** |
| 27 * @param {function(?string)} callback Callback called with the extension ID. | 25 * @param {function(?string)} callback Callback called with the extension ID. |
| 28 * The ID may be null if extension is not found. | 26 * The ID may be null if extension is not found. |
| 29 */ | 27 */ |
| 30 CastExtensionDiscoverer.findInstalledExtension = function(callback) { | 28 CastExtensionDiscoverer.findInstalledExtension = function(callback) { |
| 31 CastExtensionDiscoverer.findInstalledExtensionHelper_(0, callback); | 29 CastExtensionDiscoverer.findInstalledExtensionHelper_(0, callback); |
| 32 }; | 30 }; |
| 33 | 31 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 xhr.onerror = function() { callback(false); }; | 70 xhr.onerror = function() { callback(false); }; |
| 73 /** @param {*} event */ | 71 /** @param {*} event */ |
| 74 xhr.onreadystatechange = function(event) { | 72 xhr.onreadystatechange = function(event) { |
| 75 if (xhr.readyState == 4 && xhr.status === 200) { | 73 if (xhr.readyState == 4 && xhr.status === 200) { |
| 76 // Cast extension found. | 74 // Cast extension found. |
| 77 callback(true); | 75 callback(true); |
| 78 } | 76 } |
| 79 }.wrap(this); | 77 }.wrap(this); |
| 80 xhr.send(); | 78 xhr.send(); |
| 81 }; | 79 }; |
| OLD | NEW |