Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / resources / supervised_user_block_interstitial.js
1 // Copyright 2014 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 function sendCommand(cmd) {
6   window.domAutomationController.setAutomationId(1);
7   window.domAutomationController.send(cmd);
8 }
9
10 function 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  */
27 function 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
34 document.addEventListener('DOMContentLoaded', initialize);