Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: chrome/browser/resources/identity_scope_approval_dialog/scope_approval_dialog.js

Issue 23493021: Use webview.request in OAuth scope approval dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var webview; 5 var webview;
6 6
7 /** 7 /**
8 * Points the webview to the starting URL of a scope authorization 8 * Points the webview to the starting URL of a scope authorization
9 * flow, and unhides the dialog once the page has loaded. 9 * flow, and unhides the dialog once the page has loaded.
10 * @param {string} url The url of the authorization entry point. 10 * @param {string} url The url of the authorization entry point.
11 * @param {Object} win The dialog window that contains this page. Can 11 * @param {Object} win The dialog window that contains this page. Can
12 * be left undefined if the caller does not want to display the 12 * be left undefined if the caller does not want to display the
13 * window. 13 * window.
14 */ 14 */
15 function loadAuthUrlAndShowWindow(url, win) { 15 function loadAuthUrlAndShowWindow(url, win) {
16 // Send popups from the webview to a normal browser window. 16 // Send popups from the webview to a normal browser window.
17 webview.addEventListener('newwindow', function(e) { 17 webview.addEventListener('newwindow', function(e) {
18 e.window.discard(); 18 e.window.discard();
19 window.open(e.targetUrl); 19 window.open(e.targetUrl);
20 }); 20 });
21 21
22 // Request a customized view from GAIA. 22 // Request a customized view from GAIA.
23 webview.onBeforeSendHeaders.addListener(function(details) { 23 webview.request.onBeforeSendHeaders.addListener(function(details) {
24 headers = details.requestHeaders || []; 24 headers = details.requestHeaders || [];
25 headers.push({'name': 'X-Browser-View', 25 headers.push({'name': 'X-Browser-View',
26 'value': 'embedded'}); 26 'value': 'embedded'});
27 return { requestHeaders: headers }; 27 return { requestHeaders: headers };
28 }, { 28 }, {
29 urls: ['https://accounts.google.com/*'], 29 urls: ['https://accounts.google.com/*'],
30 }, ['blocking', 'requestHeaders']); 30 }, ['blocking', 'requestHeaders']);
31 31
32 if (url.toLowerCase().indexOf('https://accounts.google.com/') != 0) 32 if (url.toLowerCase().indexOf('https://accounts.google.com/') != 0)
33 document.querySelector('.titlebar').classList.add('titlebar-border'); 33 document.querySelector('.titlebar').classList.add('titlebar-border');
(...skipping 22 matching lines...) Expand all
56 } 56 }
57 57
58 insertRule('.titlebar-close-button', resources.IDR_CLOSE_DIALOG); 58 insertRule('.titlebar-close-button', resources.IDR_CLOSE_DIALOG);
59 insertRule('.titlebar-close-button:hover', resources.IDR_CLOSE_DIALOG_H); 59 insertRule('.titlebar-close-button:hover', resources.IDR_CLOSE_DIALOG_H);
60 insertRule('.titlebar-close-button:active', resources.IDR_CLOSE_DIALOG_P); 60 insertRule('.titlebar-close-button:active', resources.IDR_CLOSE_DIALOG_P);
61 61
62 document.title = resources.IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE; 62 document.title = resources.IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE;
63 }); 63 });
64 }); 64 });
65 65
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698