| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * UI Pages. Note the order must be in sync with the | 6 * UI Pages. Note the order must be in sync with the |
| 7 * ArcAuthService::UIPage enum. | 7 * ArcAuthService::UIPage enum. |
| 8 * @type {Array<string>} | 8 * @type {Array<string>} |
| 9 */ | 9 */ |
| 10 var UI_PAGES = ['none', | 10 var UI_PAGES = ['none', |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 }; | 181 }; |
| 182 | 182 |
| 183 var onWebviewRequestResponseStarted = function(details) { | 183 var onWebviewRequestResponseStarted = function(details) { |
| 184 if (isApprovalResponse(details.url)) { | 184 if (isApprovalResponse(details.url)) { |
| 185 showPage('arc-loading'); | 185 showPage('arc-loading'); |
| 186 } | 186 } |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 var onWebviewContentLoad = function() { | 189 var onWebviewContentLoad = function() { |
| 190 if (!isApprovalResponse(webview.src)) { | 190 if (!isApprovalResponse(webview.src)) { |
| 191 // Show LSO page when its content is ready. | |
| 192 showPage('lso'); | |
| 193 return; | 191 return; |
| 194 } | 192 } |
| 195 | 193 |
| 196 webview.executeScript({code: 'document.title;'}, function(results) { | 194 webview.executeScript({code: 'document.title;'}, function(results) { |
| 197 var authCodePrefix = 'Success code='; | 195 var authCodePrefix = 'Success code='; |
| 198 if (results[0].substring(0, authCodePrefix.length) == | 196 if (results[0].substring(0, authCodePrefix.length) == |
| 199 authCodePrefix) { | 197 authCodePrefix) { |
| 200 var authCode = results[0].substring(authCodePrefix.length); | 198 var authCode = results[0].substring(authCodePrefix.length); |
| 201 sendNativeMessage('setAuthCode', {code: authCode}); | 199 sendNativeMessage('setAuthCode', {code: authCode}); |
| 202 } else { | 200 } else { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 type: 'chrome', | 250 type: 'chrome', |
| 253 color: '#67a030' | 251 color: '#67a030' |
| 254 }, | 252 }, |
| 255 'innerBounds': { | 253 'innerBounds': { |
| 256 'width': 800, | 254 'width': 800, |
| 257 'height': 600 | 255 'height': 600 |
| 258 } | 256 } |
| 259 }; | 257 }; |
| 260 chrome.app.window.create('main.html', options, onWindowCreated); | 258 chrome.app.window.create('main.html', options, onWindowCreated); |
| 261 }); | 259 }); |
| OLD | NEW |