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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * Class that routes gnubby-auth extension messages to and from the gnubbyd | 7 * Class that routes gnubby-auth extension messages to and from the gnubbyd |
8 * extension. | 8 * extension. |
9 */ | 9 */ |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 * @private | 46 * @private |
47 */ | 47 */ |
48 remoting.GnubbyAuthHandler.prototype.callback_ = | 48 remoting.GnubbyAuthHandler.prototype.callback_ = |
49 function(connectionId, response) { | 49 function(connectionId, response) { |
50 try { | 50 try { |
51 this.clientSession_.sendGnubbyAuthMessage({ | 51 this.clientSession_.sendGnubbyAuthMessage({ |
52 'type': 'data', | 52 'type': 'data', |
53 'connectionId': connectionId, | 53 'connectionId': connectionId, |
54 'data': getArrayAttr(response, 'data') | 54 'data': getArrayAttr(response, 'data') |
55 }); | 55 }); |
56 } catch (err) { | 56 } catch (/** @type {*} */ err) { |
57 console.error('gnubby callback failed: ', /** @type {*} */ (err)); | 57 console.error('gnubby callback failed: ', err); |
58 this.clientSession_.sendGnubbyAuthMessage({ | 58 this.clientSession_.sendGnubbyAuthMessage({ |
59 'type': 'error', | 59 'type': 'error', |
60 'connectionId': connectionId | 60 'connectionId': connectionId |
61 }); | 61 }); |
62 return; | 62 return; |
63 } | 63 } |
64 }; | 64 }; |
65 | 65 |
66 /** | 66 /** |
67 * Send data to the gnubbyd extension. | 67 * Send data to the gnubbyd extension. |
(...skipping 23 matching lines...) Expand all Loading... |
91 */ | 91 */ |
92 function onGnubbydDevReply_(jsonObject, callback, reply) { | 92 function onGnubbydDevReply_(jsonObject, callback, reply) { |
93 var kGnubbydStableExtensionId = 'beknehfpfkghjoafdifaflglpjkojoco'; | 93 var kGnubbydStableExtensionId = 'beknehfpfkghjoafdifaflglpjkojoco'; |
94 | 94 |
95 if (reply) { | 95 if (reply) { |
96 callback(reply); | 96 callback(reply); |
97 } else { | 97 } else { |
98 chrome.runtime.sendMessage(kGnubbydStableExtensionId, jsonObject, callback); | 98 chrome.runtime.sendMessage(kGnubbydStableExtensionId, jsonObject, callback); |
99 } | 99 } |
100 } | 100 } |
OLD | NEW |