| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 * Displays a webview based authorization dialog. | 6 * Displays a webview based authorization dialog. |
| 7 * @param {string} key A unique identifier that the caller can use to locate | 7 * @param {string} key A unique identifier that the caller can use to locate |
| 8 * the dialog window. | 8 * the dialog window. |
| 9 * @param {string} url A URL that will be loaded in the webview. | 9 * @param {string} url A URL that will be loaded in the webview. |
| 10 * @param {string} mode 'interactive' or 'silent'. The window will be displayed | 10 * @param {string} mode 'interactive' or 'silent'. The window will be displayed |
| 11 * if the mode is 'interactive'. | 11 * if the mode is 'interactive'. |
| 12 */ | 12 */ |
| 13 function showAuthDialog(key, url, mode) { | 13 function showAuthDialog(key, url, mode) { |
| 14 var options = { | 14 var options = |
| 15 frame: 'none', | 15 {frame: 'none', id: key, minWidth: 1024, minHeight: 768, hidden: true}; |
| 16 id: key, | 16 chrome.app.window.create( |
| 17 minWidth: 1024, | 17 'scope_approval_dialog.html', options, function(win) { |
| 18 minHeight: 768, | 18 win.contentWindow.addEventListener('load', function(event) { |
| 19 hidden: true | 19 var windowParam; |
| 20 }; | 20 if (mode == 'interactive') |
| 21 chrome.app.window.create('scope_approval_dialog.html', | 21 windowParam = win; |
| 22 options, | 22 win.contentWindow.loadAuthUrlAndShowWindow(url, windowParam); |
| 23 function(win) { | 23 }); |
| 24 win.contentWindow.addEventListener('load', function(event) { | 24 }); |
| 25 var windowParam; | |
| 26 if (mode == 'interactive') | |
| 27 windowParam = win; | |
| 28 win.contentWindow.loadAuthUrlAndShowWindow(url, windowParam); | |
| 29 }); | |
| 30 }); | |
| 31 } | 25 } |
| 32 | 26 |
| 33 chrome.identityPrivate.onWebFlowRequest.addListener(showAuthDialog); | 27 chrome.identityPrivate.onWebFlowRequest.addListener(showAuthDialog); |
| 34 | |
| OLD | NEW |