| 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 /** | 7 /** |
| 8 * Discover the ID of installed cast extension. | 8 * Discover the ID of installed cast extension. |
| 9 * @constructor | 9 * @constructor |
| 10 */ | 10 */ |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 * @param {function(boolean)} callback Callback to notify the result. | 64 * @param {function(boolean)} callback Callback to notify the result. |
| 65 * @private | 65 * @private |
| 66 */ | 66 */ |
| 67 CastExtensionDiscoverer.isExtensionInstalled_ = | 67 CastExtensionDiscoverer.isExtensionInstalled_ = |
| 68 function(extensionId, callback) { | 68 function(extensionId, callback) { |
| 69 | 69 |
| 70 var xhr = new XMLHttpRequest(); | 70 var xhr = new XMLHttpRequest(); |
| 71 var url = 'chrome-extension://' + extensionId + '/cast_sender.js'; | 71 var url = 'chrome-extension://' + extensionId + '/cast_sender.js'; |
| 72 xhr.open('GET', url, true); | 72 xhr.open('GET', url, true); |
| 73 xhr.onerror = function() { callback(false); }; | 73 xhr.onerror = function() { callback(false); }; |
| 74 xhr.onreadystatechange = | 74 /** @param {*} event */ |
| 75 /** @param {*} response */ | 75 xhr.onreadystatechange = function(event) { |
| 76 function(event) { | 76 if (xhr.readyState == 4 && xhr.status === 200) { |
| 77 if (xhr.readyState == 4 && xhr.status === 200) { | 77 // Cast extension found. |
| 78 // Cast extension found. | 78 callback(true); |
| 79 callback(true); | 79 } |
| 80 } | 80 }.wrap(this); |
| 81 }.wrap(this); | |
| 82 xhr.send(); | 81 xhr.send(); |
| 83 }; | 82 }; |
| OLD | NEW |