1// Copyright (c) 2012 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 5function sendCommand(cmd) { 6 window.domAutomationController.setAutomationId(1); 7 window.domAutomationController.send(cmd); 8} 9 10function initialize() { 11 if (loadTimeData.getBoolean('allowAccessRequests')) { 12 $('request-access-button').onclick = function(event) { 13 updateAfterRequestSent(); 14 sendCommand('request'); 15 }; 16 } else { 17 $('request-access-button').hidden = true; 18 } 19 $('back-button').onclick = function(event) { 20 sendCommand('back'); 21 }; 22} 23 24/** 25 * Updates the interstitial to show that the request was sent. 26 */ 27function updateAfterRequestSent() { 28 $('error-img').hidden = true; 29 $('request-access-button').hidden = true; 30 $('block-page-message').hidden = true; 31 $('request-sent-message').hidden = false; 32} 33 34document.addEventListener('DOMContentLoaded', initialize); 35