| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 Copyright 2016 The LUCI Authors. All rights reserved. | 2 Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 Use of this source code is governed under the Apache License, Version 2.0 | 3 Use of this source code is governed under the Apache License, Version 2.0 |
| 4 that can be found in the LICENSE file. | 4 that can be found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 | 6 |
| 7 <link rel="import" href="../bower_components/polymer/polymer.html"> | 7 <link rel="import" href="../bower_components/polymer/polymer.html"> |
| 8 <link rel="import" href="../bower_components/google-signin/google-signin-aware.h
tml"> | 8 <link rel="import" href="../bower_components/google-signin/google-signin-aware.h
tml"> |
| 9 | 9 |
| 10 <link rel="import" href="/static/common/rpc/rpc-client.html"> | 10 <link rel="import" href="/static/common/rpc/rpc-client.html"> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 }, | 154 }, |
| 155 | 155 |
| 156 _onKeypress: function(e) { | 156 _onKeypress: function(e) { |
| 157 if (e.key === 'Enter' && e.shiftKey) { | 157 if (e.key === 'Enter' && e.shiftKey) { |
| 158 this.send(); | 158 this.send(); |
| 159 e.preventDefault(); | 159 e.preventDefault(); |
| 160 } | 160 } |
| 161 }, | 161 }, |
| 162 | 162 |
| 163 getAccessToken: function() { | 163 getAccessToken: function() { |
| 164 var user = gapi.auth2.getAuthInstance().currentUser.get(); | 164 var authInstance = gapi.auth2.getAuthInstance(); |
| 165 if (!authInstance) { |
| 166 return null; |
| 167 } |
| 168 var user = authInstance.currentUser.get(); |
| 165 if (!user) { | 169 if (!user) { |
| 166 return null; | 170 return null; |
| 167 } | 171 } |
| 168 return user.getAuthResponse().access_token; | 172 return user.getAuthResponse().access_token; |
| 169 }, | 173 }, |
| 170 | 174 |
| 171 send: function() { | 175 send: function() { |
| 172 this.error = null; | 176 this.error = null; |
| 173 try { | 177 try { |
| 174 this.requestObject = JSON.parse(this.requestText); | 178 this.requestObject = JSON.parse(this.requestText); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 isGrpcError: true, | 212 isGrpcError: true, |
| 209 code: this.error.code, | 213 code: this.error.code, |
| 210 codeName: luci.rpc.CodeName(this.error.code), | 214 codeName: luci.rpc.CodeName(this.error.code), |
| 211 description: this.error.description | 215 description: this.error.description |
| 212 }; | 216 }; |
| 213 } | 217 } |
| 214 } | 218 } |
| 215 }); | 219 }); |
| 216 </script> | 220 </script> |
| 217 </dom-module> | 221 </dom-module> |
| OLD | NEW |