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 * Chrome window that hosts UI. Only one window is allowed. | 6 * Chrome window that hosts UI. Only one window is allowed. |
7 * @type {chrome.app.window.AppWindow} | 7 * @type {chrome.app.window.AppWindow} |
8 */ | 8 */ |
9 var appWindow = null; | 9 var appWindow = null; |
10 | 10 |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return; | 668 return; |
669 } | 669 } |
670 | 670 |
671 lsoView.executeScript({code: 'document.title;'}, function(results) { | 671 lsoView.executeScript({code: 'document.title;'}, function(results) { |
672 var authCodePrefix = 'Success code='; | 672 var authCodePrefix = 'Success code='; |
673 if (results && results.length == 1 && typeof results[0] == 'string' && | 673 if (results && results.length == 1 && typeof results[0] == 'string' && |
674 results[0].substring(0, authCodePrefix.length) == authCodePrefix) { | 674 results[0].substring(0, authCodePrefix.length) == authCodePrefix) { |
675 var authCode = results[0].substring(authCodePrefix.length); | 675 var authCode = results[0].substring(authCodePrefix.length); |
676 sendNativeMessage('onAuthSucceeded', {code: authCode}); | 676 sendNativeMessage('onAuthSucceeded', {code: authCode}); |
677 } else { | 677 } else { |
678 showErrorMessage( | 678 sendNativeMessage('onAuthFailed'); |
| 679 showErrorPage( |
679 appWindow.contentWindow.loadTimeData.getString( | 680 appWindow.contentWindow.loadTimeData.getString( |
680 'authorizationFailed')); | 681 'authorizationFailed')); |
681 } | 682 } |
682 }); | 683 }); |
683 }; | 684 }; |
684 | 685 |
685 var requestFilter = { | 686 var requestFilter = { |
686 urls: ['<all_urls>'], | 687 urls: ['<all_urls>'], |
687 types: ['main_frame'] | 688 types: ['main_frame'] |
688 }; | 689 }; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 type: 'chrome', | 746 type: 'chrome', |
746 color: '#ffffff' | 747 color: '#ffffff' |
747 }, | 748 }, |
748 'innerBounds': { | 749 'innerBounds': { |
749 'width': INNER_WIDTH, | 750 'width': INNER_WIDTH, |
750 'height': INNER_HEIGHT | 751 'height': INNER_HEIGHT |
751 } | 752 } |
752 }; | 753 }; |
753 chrome.app.window.create('main.html', options, onWindowCreated); | 754 chrome.app.window.create('main.html', options, onWindowCreated); |
754 }); | 755 }); |
OLD | NEW |