OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 var webview; | |
6 | |
7 /** | |
8 * Points the webview to the starting URL of a scope authorization | |
9 * flow, and unhides the dialog once the page has loaded. | |
10 * @param {string} url The url of the authorization entry point. | |
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 | |
13 * window. | |
14 */ | |
15 function loadAuthUrlAndShowWindow(url, win) { | |
16 webview.src = url; | |
17 if (win) { | |
18 webview.addEventListener('loadstop', function() { | |
19 win.show(); | |
20 }); | |
21 } | |
22 } | |
23 | |
24 document.addEventListener('DOMContentLoaded', function() { | |
25 webview = document.querySelector('webview'); | |
26 | |
27 document.querySelector('.titlebar-close-button').onclick = function() { | |
28 window.close(); | |
29 }; | |
30 | |
31 chrome.identityPrivate.getResources(function(resources) { | |
32 var style = document.styleSheets[0]; | |
33 | |
34 function insertRule(selector, url) { | |
35 style.insertRule(selector + ' { background-image: url(' + url + '); }', | |
36 style.cssRules.length); | |
37 } | |
38 | |
39 insertRule('.titlebar-close-button', resources.IDR_CLOSE_DIALOG); | |
40 insertRule('.titlebar-close-button:hover', resources.IDR_CLOSE_DIALOG_H); | |
41 insertRule('.titlebar-close-button:active', resources.IDR_CLOSE_DIALOG_P); | |
42 | |
43 document.title = resources.IDS_EXTENSION_PERMISSIONS_PROMPT_TITLE; | |
44 }); | |
45 }); | |
46 | |
OLD | NEW |